mysql查询表结构命令

1.-- 查看表结构
  DESC 表名;3d

主要是字段类型,主键,是否容许为空等。orm

2. 查看表中字段的结构信息 blog

  能够用来查看表中字段的注释等,好比io

  select  table_name,column_name,column_comment  from information_schema.columns where table_schema ='表所在的库'  and table_name = '要查看的表名' ;table

 

3.查看库里面表的结构信息  form

  能够用来查看表的注释信息select

  select table_name,table_comment from information_schema.tables where table_schema = '表所在的库' and table_name ='表名' ;im

  去掉 table_name 限定条件,便可查看指定库中的全部表信息db

 

4.查看表的DDL语句img

  show create table 表名;

相关文章
相关标签/搜索