在MySQL数据库中,
字段或列的注释是用属性comment来添加.
创建新表的脚本中,
可在字段定义脚本中添加comment属性来添加注释.
示例代码如下:
create table test(
id int not null default 0 comment '用户id'
)
如果是已经建好的表,
也可以用修改字段的命令,然后加上comment属性定义,就可以添加上注释了.
alter table test
change column id id int not null default 0 comment '测试表id'
给表的字段或列添加注释已经知道了,
那么如何来查看已有表的所有字段的注释呢?
可以用命令:show full columns from table 来查看,
示例如下:
show full columns from test;
mysqli_fetch_assoc 是从结果集中取得一行作为关联数组,因为结果集中不存在键名为0的值,所以$CommentsData[0]这个是空值,可以输出一下上面的$CommentsData,这个应该是有值的
使用Navicat
for
mysql
show create table 表名
如果表中的字段,使用comment进行描述了,这里可以看到.
在MySQL数据库中,\x0d\x0a字段或列的注释是用属性comment来添加.\x0d\x0a\x0d\x0a创建新表的脚本中,\x0d\x0a可在字段定义脚本中添加comment属性来添加注释.\x0d\x0a\x0d\x0a示例代码如下:\x0d\x0acreate table test(\x0d\x0aid int not null default 0 comment '用户id'\x0d\x0a)\x0d\x0a\x0d\x0a如果是已经建好的表,\x0d\x0a也可以用修改字段的命令,然后加上comment属性定义,就可以添加上注释了.\x0d\x0a\x0d\x0a示例代码如下:\x0d\x0aalter table test\x0d\x0achange column id id int not null default 0 comment '测试表id\x0d\x0a\x0d\x0a给表的字段或列添加注释已经知道了,\x0d\x0a那么如何来查看已有表的所有字段的注释呢?\x0d\x0a可以用命令:show full columns from table 来查看,\x0d\x0a示例如下:\x0d\x0ashow full columns from test;
以上就是土嘎嘎小编为大家整理的mysql字段注释怎么看相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!