mysql查詢表結構命令


1.-- 查看表結構
  DESC 表名;

主要是字段類型,主鍵,是否允許為空等。

2. 查看表中字段的結構信息 

  可以用來查看表中字段的注釋等,比如

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

 

3.查看庫里面表的結構信息  

  可以用來查看表的注釋信息

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

  去掉 table_name 限定條件,即可查看指定庫中的所有表信息

 

4.查看表的DDL語句

  show create table 表名;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM