查看mysql表结构信息
一、简单描述表结构,字段类型
desc tabl_name; 或describe columns;
显示表结构,字段类型,主键,是否为空等属性,但不显示外键和字段的注释。
二,查看表生成的DDL
show create table 表名;
这个命令虽然显示起来不是太容易看, 这个不是问题可以用\G来结尾,使得结果容易阅读;该命令把创建表的DDL显示出来,于是表结构、类型,外键,备注全部显示出来了。我比较喜欢这个命令:输入简单,显示结果全面。
三,查询表中列的注释信息
use information_schema
select * from columns where table_name = '表名' ;
四、查看表的注释
select table_name,table_comment frominformation_schema.tables where table_schema = 'db' and table_name='表名'
五,只查询列名和注释
select column_name, column_comment from information_schema.columnswhere table_schema ='db' and table_name = '表名' ;
热门日志
分类
- Php(101)
- Java(8)
- Mysql(32)
- Ajax(2)
- Jsp(1)
- Struts(8)
- Linux(71)
- JavaScript(39)
- Staruml(0)
- Mouth(1)
- Html(6)
- Windows(8)
- Message(12)
- Lua(10)
- Compute(1)
- Redis(7)
- Nginx(11)
- Jquery(1)
- Apache(1)
- cocos2d-x(8)
- about(1)
- ssdb(1)
- Mac(7)
- C(1)
- memcache(1)
- Python(30)
- Vim(8)
- sed(2)
- ansible(3)
- awk(4)
- shell(3)
- Django(4)
- git(7)
- bat(4)
- svn(0)
- docker(1)
- Tornado(1)
- go(1)
- 架构(16)
- Vue(1)
最新日志
- Docker 那些事
- 欢迎您关注“刘善海价值分享”微信公众号!
- Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
- Linux vim/vi下backspace(退格键)出现^? 或^H
- python 如何通过subprocess.call调用自定义alias别名
- python2 python3中long类型的区别
- 10 个 Linux 中方便的 Bash 别名
- 'python' engine because the 'c' engine does not support regex separators
- importError c extension: No module named np_datetine not buit
- 四个提高工作效率的小技巧