mysql 表结构查询的SQL语句

╰+哭是因爲堅強的太久メ 2023-03-01 09:09 104阅读 0赞

1、查看表结构

  1. desc student;

在这里插入图片描述

2、查看表的DDL语句

  1. show create table student;

在这里插入图片描述

3、查看列的结构信息

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

在这里插入图片描述

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

4、查看表的注释

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

在这里插入图片描述

发表评论

表情:
评论列表 (有 0 条评论,104人围观)

还没有评论,来说两句吧...

相关阅读