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的某几行的数据 

       

  

  

猜你喜欢

转载自www.cnblogs.com/haloujava/p/11119645.html