如何在现有 MySQL 表的列中添加注释?
mysqlmysqli database更新于 2025/4/6 2:52:17
可以在使用 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)
相关文章
有用资源
mysql 参考教程 - 该教程包含有关 mysql 的更多信息:https://www.cainiaomax.com/mysql/

