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 表名;

相關文章
相關標籤/搜索