如何将注释放入现有 MySQL 表中的某一列?
在使用 ALTER TABLE 命令修改列时,可使用“COMMENT”关键字来实现。例如,如果我们想在表“testing”的“id”列中添加注释,则以下查询将实现此操作
mysql> ALTER TABLE testing MODIFY id INT COMMENT 'id of employees'; Query OK, 0 rows affected (0.07 sec) Records: 0 Duplicates: 0 Warnings: 0
使用以下查询,可在列的注释字段中进行检查。
mysql> Show full columns from testing\G *************************** 1. row *************************** Field: id Type: int(11) Collation: NULL Null: NO Key: PRI Default: 0 Extra: Privileges: select,insert,update,references Comment: id of employees *************************** 2. row *************************** Field: Name Type: varchar(20) Collation: latin1_swedish_ci Null: YES Key: Default: NULL Extra: Privileges: select,insert,update,references Comment: 2 rows in set (0.05 sec)
广告
数据结构
网络
关系型数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP