sql >> Database >  >> RDS >> Mysql

mySQL toevoegen van gegevens over kolomeinden

hier kun je de backticks zien

alter table `data` add `timestamp` VARCHAR(20);

VOORBEELD

MariaDB []> desc data;
+-------+----------------------+------+-----+---------+----------------+
| Field | Type                 | Null | Key | Default | Extra          |
+-------+----------------------+------+-----+---------+----------------+
| id    | int(11) unsigned     | NO   | PRI | NULL    | auto_increment |
| e     | enum('x1','x2','x3') | YES  |     | NULL    |                |
+-------+----------------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)

MariaDB []> alter table `data` add `timestamp` VARCHAR(20);
Query OK, 0 rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB []> desc data;
+-----------+----------------------+------+-----+---------+----------------+
| Field     | Type                 | Null | Key | Default | Extra          |
+-----------+----------------------+------+-----+---------+----------------+
| id        | int(11) unsigned     | NO   | PRI | NULL    | auto_increment |
| e         | enum('x1','x2','x3') | YES  |     | NULL    |                |
| timestamp | varchar(20)          | YES  |     | NULL    |                |
+-----------+----------------------+------+-----+---------+----------------+
3 rows in set (0.01 sec)

Tabelgegevens

MariaDB [who]> select * from `data`;
+----+------+-----------+
| id | e    | timestamp |
+----+------+-----------+
|  1 | x1   | NULL      |
|  2 | x2   | NULL      |
+----+------+-----------+
2 rows in set (0.00 sec)

MariaDB [who]>



  1. Hoe de bindValue-methode toe te passen in de LIMIT-clausule?

  2. Problemen met het weergeven van blob-afbeeldingen

  3. Geen toegang tot MySql root-gebruiker, zelfs niet na het instellen van het wachtwoord via de veilige modus in de linux-terminal

  4. JDBC retourneert MySQLSyntaxError Exception met de juiste instructie