Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMMENT 注释 #148

Open
lovelmh13 opened this issue Jul 26, 2021 · 0 comments
Open

COMMENT 注释 #148

lovelmh13 opened this issue Jul 26, 2021 · 0 comments

Comments

@lovelmh13
Copy link
Owner

创建表的时候加注释

CREATE TABLE test (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `status` int(11) NOT NULL DEFAULT '0' COMMENT '1: 正常, -1 :删除',
    PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

查看注释

SHOW FULL COLUMNS FROM test

image

给已有字段 ,添加注释或更改已有的注释

只是在修改的语句后面添加 COMMENT。

不能不写 id int(11) AUTO_INCREMENT

ALTER TABLE `test` CHANGE COLUMN `id` `id` int(11) AUTO_INCREMENT COMMENT '主键 id'

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant