mysql注释颜色更改_更改mysql表注释

DROP TABLE IF EXISTS test_comments;

Query OK, 0 rows affected (0.08 sec)

CREATE TABLE test_comments (ID INT, name CHAR(30)) COMMENT 'Hello World';

Query OK, 0 rows affected (0.22 sec)

检查表结构中的注释

show create table test_comments\G

*************************** 1. row ***************************

Table: test_comments

Create Table: CREATE TABLE `test_comments` (

`ID` int(11) DEFAULT NULL,

`name` char(30) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Hello World'

1 row in set (0.00 sec)

您还可以查看来自information_schema的评论,如下所示

SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME = 'test_comments';

+---------------+

| TABLE_COMMENT |

+---------------+

| Hello World |

+---------------+

1 row in set (0.00 sec)

修改表以修改注释

ALTER TABLE test_comments COMMENT = 'This is just to test how to alter comments';

Query OK, 0 rows affected (0.08 sec)

Records: 0 Duplicates: 0 Warnings: 0

检查修改后的评论

show create table test_comments\G

*************************** 1. row ***************************

Table: test_comments

Create Table: CREATE TABLE `test_comments` (

`ID` int(11) DEFAULT NULL,

`name` char(30) DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='This is just to test how to alter comments'

1 row in set (0.00 sec)

SELECT TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_NAME = 'test_comments';

+--------------------------------------------+

| TABLE_COMMENT |

+--------------------------------------------+

| This is just to test how to alter comments |

+--------------------------------------------+

1 row in set (0.00 sec)


版权声明:本文为weixin_35988178原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。