mysql 表结构查询的SQL语句

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

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/xiaojin21cen/article/details/107531738