mysql如何查询表字所有字段?


当前第2页 返回上一页

获取以下信息
Field :字段名
Type:字段类型
Collation:字符集(mysql 5.0以上有)
Null :是否可以为NULL
Key:索引(PRI,unique,index)
Default:缺省值
Extra:额外(是否 auto_increment)
Privileges:权限
Comment:备注(mysql 5.0以上有)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

mysql> create table teacher  # 创建teacher表

    -> (

    -> Id int (5) auto_increment not null primary key,

    -> name char(10) not null,

    -> address varchar(50) default 'No.1 Mid school',

    -> year date

    -> );

Query OK, 0 rows affected (0.02 sec)

 

mysql> show tables;

+------------------+

| Tables_in_school |

+------------------+

| teacher          |

+------------------+

1 row in set (0.00 sec)

 

mysql> show full columns from teacher;  # 显示teacher表的所有字段

+---------+-------------+-------------------+------+-----+-----------------+----------------+---------------------------------+---------+

| Field   | Type        | Collation         | Null | Key | Default         | Extra          | Privileges                      | Comment |

+---------+-------------+-------------------+------+-----+-----------------+----------------+---------------------------------+---------+

| Id      | int(5)      | NULL              | NO   | PRI | NULL            | auto_increment | select,insert,update,references |         |

| name    | char(10)    | latin1_swedish_ci | NO   |     | NULL            |                | select,insert,update,references |         |

| address | varchar(50) | latin1_swedish_ci | YES  |     | No.1 Mid school |                | select,insert,update,references |         |

| year    | date        | NULL              | YES  |     | NULL            |                | select,insert,update,references |         |

+---------+-------------+-------------------+------+-----+-----------------+----------------+---------------------------------+---------+

4 rows in set (0.01 sec)

 

mysql> drop table teacher;  # 删除teacher表

Query OK, 0 rows affected (0.03 sec)

 

mysql> show tables;

Empty set (0.00 sec)

 

mysql>

推荐教程:mysql视频教程

以上就是mysql如何查询表字所有字段?的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

mysql查询语句优先级是什么?

通过mysql 判断点是否在指定多边形区域内

mysql添加用户失败怎么办

你知道mysql锁与事物隔离级别吗?

mysql 出现1290错误怎么办

如何在linux中重置mysql root密码

mysql中如何实现排名

mysql mac如何设置密码

mysql数据库的基础知识

关于mysql的基础知识详解

更多相关阅读请进入《mysql》频道 >>


数据库系统概念 第6版
书籍

数据库系统概念 第6版

机械工业出版社

本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...