Mysql
 sql >> Teknologi Basis Data >  >> RDS >> Mysql

mySQL menambahkan data jeda kolom

di sini Anda dapat melihat backtick

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

CONTOH

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)

Data Tabel

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

MariaDB [who]>



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Tidak termasuk beberapa nilai dari array

  2. Apa arti ikon kolom meja kerja mysql?

  3. Setara dengan fungsi SQLServer SCOPE_IDENTITY() di mySQL?

  4. Cara mengambil catatan kecocokan di beberapa tabel di MySQL

  5. GALAT #1054 - Kolom 'program_id' tidak diketahui di 'BARU