查看数据表结构
SHOW COLUMNS FROM tbl_name
比如查看名为tb1这个列的数据表结构
SHOW COLUMNS FROM tb1;
将会显示2-6节中创建的tb1的具体内容
值得注意的是,我们需要正确的区分查看数据表和查看数据表结构
下面是分别是查看数据表和数据结构显示的内容
mysql> SHOW COLUMNS FROM tb1; +----------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+---------------------+------+-----+---------+-------+ | username | varchar(20) | YES | | NULL | | | age | tinyint(3) unsigned | YES | | NULL | | | salary | float(8,2) unsigned | YES | | NULL | | +----------+---------------------+------+-----+---------+-------+ 3 rows in set (0.01 sec)
mysql> SHOW TABLES; +----------------+ | Tables_in_test | +----------------+ | tb1 | +----------------+ 1 row in set (0.00 sec)
请登录之后再进行评论