为了账号安全,请及时绑定邮箱和手机立即绑定

请问一下在mysql中的 COMMENT 有什么作用吗??

请问一下在mysql中的 COMMENT 有什么作用吗??

繁星淼淼 2019-10-28 10:06:19
mysql中的 COMMENT 有什么作用吗?
查看完整描述

3 回答

?
翻阅古今

TA贡献1780条经验 获得超5个赞

comment---备注说明的意思,如:

create table tb_test(id int comment '该列作为记录号');

就算你删除那部分,你的语句还是会有错的,因为mysql下auto_increment必须为key,改后如下:

CREATE TABLE `hg_pay_exchange` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT primary key COMMENT 'id',
`module` varchar(15) NOT NULL,
`type` enum('amount','point') NOT NULL,
`number` decimal(8,2) NOT NULL)

查看完整回答
反对 回复 2019-11-16
?
天涯尽头无女友

TA贡献1831条经验 获得超9个赞

字段的注释信息。

1234567891011use test; show tables; create table if not exists test_user(    id int auto_increment primary key comment 'primay key',    username varchar(50) not null,    age smallint not null comment '年龄') engine=InnoDB default charset=utf8; show full columns from test_user;


查看完整回答
反对 回复 2019-11-16
  • 3 回答
  • 0 关注
  • 1808 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信