码迷,mamicode.com
首页 > 其他好文 > 详细

查看表结构的两种方式

时间:2019-06-11 11:18:57      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:varchar   bsp   extra   结构   var   auto   select   efault   prim   

desc模式和show create table  具体模式

mysql> select * from tb_emp8;
+----+------+--------+--------+
| id | name | deptid | salary |
+----+------+--------+--------+
|  1 | ds   |      2 |   NULL |
|  2 | fr   |      7 |   NULL |
|  3 | ds   |     99 |   NULL |
+----+------+--------+--------+
3 rows in set (0.00 sec)

mysql> desc tb_emp8;
+--------+-------------+------+-----+---------+----------------+
| Field  | Type        | Null | Key | Default | Extra          |
+--------+-------------+------+-----+---------+----------------+
| id     | int(11)     | NO   | PRI | NULL    | auto_increment |
| name   | varchar(25) | NO   |     | NULL    |                |
| deptid | int(11)     | YES  |     | NULL    |                |
| salary | float       | YES  |     | NULL    |                |
+--------+-------------+------+-----+---------+----------------+
4 rows in set (0.00 sec)

mysql> show create table tb_emp8;
+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table   | Create Table                                                                                                                                                                                                                                 |
+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tb_emp8 | CREATE TABLE `tb_emp8` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(25) NOT NULL,
  `deptid` int(11) DEFAULT NULL,
  `salary` float DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 |
+---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

 

查看表结构的两种方式

标签:varchar   bsp   extra   结构   var   auto   select   efault   prim   

原文地址:https://www.cnblogs.com/tangsonghuai/p/11002073.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!