当前位置:   article > 正文

mysql 表结构查询的SQL语句_mysql查看表结构的sql语句

mysql查看表结构的sql语句

1、查看表结构

desc student;
  • 1

在这里插入图片描述

2、查看表的DDL语句

show create table student;
  • 1

在这里插入图片描述

3、查看列的结构信息

select column_name,data_type,column_comment,column_key,extra,character_maximum_length,is_nullable,column_default
from information_schema.columns 
where table_schema = (select database()) and table_name = 'student' ;
  • 1
  • 2
  • 3

在这里插入图片描述

说明: information_schema.columns 中还有其他的描述字段信息的列,可以根据需求添加。

4、查看表的注释

select table_name,table_comment 
from information_schema.tables 
where table_schema = (select database()) and table_name = 'student' ;
  • 1
  • 2
  • 3

在这里插入图片描述

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号