EN
MySQL - insert comment to column
1 points
Quick solution:
xxxxxxxxxx
1
CREATE TABLE `users` (
2
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
3
`age` BIGINT(20) NOT NULL COMMENT 'My comment here - this is age of the user',
4
PRIMARY KEY (`id`) USING BTREE
5
)
6
COLLATE='utf8_general_ci'
7
ENGINE=InnoDB
8
;
Add new column with comment to existing table:
xxxxxxxxxx
1
ALTER TABLE `users`
2
ADD COLUMN `name` VARCHAR(256) NULL DEFAULT NULL COMMENT 'This is my comment' AFTER `age`;
Change existing column and add comment:
xxxxxxxxxx
1
ALTER TABLE `users`
2
CHANGE COLUMN `name` `name` VARCHAR(256) NULL DEFAULT NULL COMMENT 'This is my second comment' AFTER `age`;