PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

我们如何使用 MySQL ALTER TABLE 命令在列上添加注释?

王林
王林 转载
2023-09-13 22:21:08 788浏览

我们如何使用 MySQL ALTER TABLE 命令在列上添加注释?

我们可以在修改列时将“COMMENT”关键字与 ALTER TABLE 命令一起使用,以在列上添加注释。例如,如果我们想在表“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 ALTER TABLE 命令在列上添加注释?的详细内容,更多请关注php中文网其它相关文章!

声明:本文转载于:tutorialspoint,如有侵犯,请联系admin@php.cn删除