mysql 查看字段详情

show COLUMNS from 表名    /*查看字段*/

mysql> show columns from user_login;
+------------+-------------+------+-----+---------+----------------+
| Field      | Type        | Null | Key | Default | Extra          |
+------------+-------------+------+-----+---------+----------------+
| id         | int(11)     | NO   | PRI | NULL    | auto_increment |
| sessionId  | bigint(255) | YES  |     | 0       |                |
| user_id    | varchar(32) | YES  | MUL | NULL    |                |
| srctype    | tinyint(4)  | YES  |     | NULL    |                |
| ip         | varchar(64) | YES  |     | NULL    |                |
| login_time | datetime    | YES  |     | NULL    |                |
+------------+-------------+------+-----+---------+----------------+

 

show full fieds from 表名

show  full COLUMNS from  表名    /*查看字段详情,包括comment*/

full fields 和 full columns效果一样:

mysql> show full COLUMNS from user_login;
+------------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------------------------------+
| Field      | Type        | Collation       | Null | Key | Default | Extra          | Privileges                      | Comment                         |
+------------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------------------------------+
| id         | int(11)     | NULL            | NO   | PRI | NULL    | auto_increment | select,insert,update,references | id                              |
| sessionId  | bigint(255) | NULL            | YES  |     | 0       |                | select,insert,update,references | 一次会话ID                  |
| user_id    | varchar(32) | utf8_general_ci | YES  | MUL | NULL    |                | select,insert,update,references |                                 |
| srctype    | tinyint(4)  | NULL            | YES  |     | NULL    |                | select,insert,update,references | 用户登录设备,0:mds,1:gqs  |
| ip         | varchar(64) | utf8_general_ci | YES  |     | NULL    |                | select,insert,update,references | 用户IP                        |
| login_time | datetime    | NULL            | YES  |     | NULL    |                | select,insert,update,references | 用户最近登录时间        |
+------------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------------------------------+
6 rows in set (0.00 sec)

mysql> show full fields from user_login;
+------------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------------------------------+
| Field      | Type        | Collation       | Null | Key | Default | Extra          | Privileges                      | Comment                         |
+------------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------------------------------+
| id         | int(11)     | NULL            | NO   | PRI | NULL    | auto_increment | select,insert,update,references | id                              |
| sessionId  | bigint(255) | NULL            | YES  |     | 0       |                | select,insert,update,references | 一次会话ID                  |
| user_id    | varchar(32) | utf8_general_ci | YES  | MUL | NULL    |                | select,insert,update,references |                                 |
| srctype    | tinyint(4)  | NULL            | YES  |     | NULL    |                | select,insert,update,references | 用户登录设备,0:mds,1:gqs  |
| ip         | varchar(64) | utf8_general_ci | YES  |     | NULL    |                | select,insert,update,references | 用户IP                        |
| login_time | datetime    | NULL            | YES  |     | NULL    |                | select,insert,update,references | 用户最近登录时间        |
+------------+-------------+-----------------+------+-----+---------+----------------+---------------------------------+---------------------------------+

show create table  表名;   /*查看创建语句*/

mysql> show create table func;
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                                                                                                                                                                                                                   |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| func  | CREATE TABLE `func` (
  `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
  `ret` tinyint(1) NOT NULL DEFAULT '0',
  `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
  `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions' |

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值