ALTER?TABLE?table_name?COMMENT='这是表的注释';
①给表加注释:
ALTER?table?table_name?MODIFY?◆column_name◆?datetime?DEFAULT?NULL?COMMENT?'这是字段的注释'
在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;
①MySQL的SQL语句里面是可以加注释的.例如:"select * from t1"可以写成"/* tag ?*/select * from t1".这个tag可以扩展成很多格式,这样在MySQL的日志中就可以看到这个tag.
①MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于Oracle旗下产品.MySQL 最流行的关系型数据库管理系统,在 WEB 应用方面MySQL是最好的 RDBMS 应用软件之一.
下一个Navicat,直接就可以再界面给注释.
非常方便,修改也很简单.
有的,用如下方法:
①.、创建表的时候写注释
create table test1
(
field_name int comment '字段的注释'
)comment='表的注释';
alter table test1 comment '修改后的表的注释';
alter table test1 modify column field_name int comment '修改后的字段注释';
--注意:字段名和字段类型照写就行
--在生成的SQL语句中看
show create table test1;
--在元数据的表里面看
use information_schema;
select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
--show
show full columns from test1;
select * from COLUMNS where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
在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表格怎么注释相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!