Mysql
 sql >> Datenbank >  >> RDS >> Mysql

MySQL fügt Spaltenunterbrechungsdaten hinzu

Hier sehen Sie die Backticks

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

BEISPIEL

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)

Tabellendaten

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

MariaDB [who]>