我們可以在修改列時(shí)將“COMMENT”關(guān)鍵字與 ALTER TABLE 命令一起使用,以在列上添加注釋。例如,如果我們想在表“testing”的“id”列中添加注釋,則以下查詢將執(zhí)行此操作 –
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
登錄后復(fù)制
通過以下查詢,可以在列的注釋字段中檢查它。
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)
登錄后復(fù)制
以上就是我們?nèi)绾问褂?MySQL ALTER TABLE 命令在列上添加注釋?的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!