mysql:SQL语句操作数据库中表和字段的comment值
2016-01-31 22:21
597 查看
1 创建表的时候写注释
create table test1
(
field_name int comment '字段的注释'
)comment='表的注释';
2 修改表的注释
alter table test1 comment '修改后的表的注释';
3 修改字段的注释
alter table test1 modify column field_name int comment '修改后的字段注释';
--注意:字段名和字段类型照写就行
4 查看表注释的方法
--在生成的SQL语句中看
show create table test1;
--在元数据的表里面看
use information_schema;
select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
5 查看字段注释的方法
--show
show full columns from test1;
--在元数据的表里面看
select * from COLUMNS where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
create table test1
(
field_name int comment '字段的注释'
)comment='表的注释';
2 修改表的注释
alter table test1 comment '修改后的表的注释';
3 修改字段的注释
alter table test1 modify column field_name int comment '修改后的字段注释';
--注意:字段名和字段类型照写就行
4 查看表注释的方法
--在生成的SQL语句中看
show create table test1;
--在元数据的表里面看
use information_schema;
select * from TABLES where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
5 查看字段注释的方法
--show
show full columns from test1;
--在元数据的表里面看
select * from COLUMNS where TABLE_SCHEMA='my_db' and TABLE_NAME='test1' \G
相关文章推荐
- mysql 严格模式 Strict Mode说明
- Ubuntu彻底删除mysql
- windows-安装mysql服务
- mysql数据库——DBA
- Broadleaf电商系统开发(四) - 切换到mysql
- mysql 字符集设置查看
- 《高性能 MySQL》读书笔记
- mysql-5.6.27-winx64 achieve 配置
- ubuntu12.04(64位)中mysql5.6.28(64位)主从复制
- mysql 更新表中字段值…
- MYSQL IFNULL函数的使用
- MySQL语句中要用到if的例子列举
- mysql 时间日期函数
- MySQL如何从表中取出随机数据
- mysql分组取每组前几条记录(排名)
- mysql 字符串排序
- mysql 重用技巧
- LeetCode数据库练习题MySql
- mysql的内存使用
- MYSQL内存评估