mysql 查询表的key_mysql查询表和字段的注释

1,新建表以及添加表和字段的注释.

create table auth_user(

ID INT(19) primary key auto_increment  comment '主键',

NAME VARCHAR(300) comment '姓名',

CREATE_TIME date comment '创建时间'

)comment  = '用户信息表';

2,修改表/字段的注释.

alter table auth_user comment  = '修改后的表注释信息(用户信息表)';

alter table auth_user modify column id int comment '主键ID';

--注意:字段名和字段类型照写就行

3,查询数据库所有表的详细信息(包括表的注释).

use information_schema;

select * from TABLES where TABLE_SCHEMA='my_db';

--查询某一张表的

use information_schema;

select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME= 'auth_user';

4,查询一张表的详细信息(包括字段注释,字段名称,类型等).

use information_schema;

select * from information_schema.columns where table_schema ='my_db'  and table_name = 'auth_user';

注:还有一种方式:

use my_db;

show full columns from auth_user;

select * from INFORMATION_SCHEMA.columns where COLUMN_NAME Like '%placement%';

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值