开发者社区 问答 正文

mysql中创建表的时候,如何给字段写备注

mysql中创建表的时候,如何给字段写备注

展开
收起
道月芬1 2021-10-15 15:42:55 501 分享 版权
1 条回答
写回答
取消 提交回答
  • mysql> create table stu_info (name varchar(20) comment "this is student name");
    Query OK, 0 rows affected (0.01 sec)
    
    
    mysql> show create table stu_info;
    +----------+-----------------------------------------------------------------------------------------------------------------------------------+
    | Table    | Create Table                                                                                                                      |
    +----------+-----------------------------------------------------------------------------------------------------------------------------------+
    | stu_info | CREATE TABLE `stu_info` (
      `name` varchar(20) DEFAULT NULL COMMENT 'this is student name'
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +----------+-----------------------------------------------------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    
    2021-10-15 15:45:01
    赞同 展开评论