Mysql 查看表结构

0.首先要有一张表,这里创建一张学生表

create table t_student(

 id int primary key auto_increment,

 name varchar(20) not null comment '姓名'

)Engine=InnoDB default charset utf8;

1.利用describe

  describe t_student;

  

     describe t_student '%na%'; 模糊查询列名为na的某几行的数据 

        

  

  describe 的简写形式 desc , 两个是等价的(重要)

2. 利用explain 

  explain t_student;

       

3. show columns from 表名

  show columns from t_student;

       

  show columns from t_student like '%name%'; 模糊查询列名为name的某几行的数据 

       

 

4. show fields from 表名

  show fields from t_student;

       

  show fields from t_student like '%name%'; 模糊查询列名为name的某几行的数据 

       

 

 

 

  

 

 

  

 

posted on 2019-07-02 11:42  指尖,写不尽  阅读(4940)  评论(0编辑  收藏  举报

导航