1、查看表结构

desc student;

2、查看表的DDL语句

show create table student;

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' ;

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

4、查看表的注释

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

更多推荐

mysql 表结构查询的SQL语句