很多时候我们都能轻易知道一张表有多少个字段,用的是什么字符集等信息,但是仅此而已,其实MySQL给我们提供了多种查询信息的方法。

1.查看字段属性、字符集、

#下面是我们熟悉的和用的最多的
mysql> show create table student_info;
mysql> show create table student_info \G #\G表示将结果纵向输出
mysql> desc student_info;
+---------+-------------+------+-----+---------+-------+
| Field   | Type        | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| id      | int(3)      | NO   |     | NULL    |       |
| name    | char(12)    | YES  |     | NULL    |       |
| dorm    | char(10)    | YES  |     | NULL    |       |
| addr    | char(12)    | YES  |     | 未知    |       |
| account | int(10)     | NO   |     | NULL    |       |
| passwd  | varchar(10) | NO   |     | NULL    |       |
+---------+-------------+------+-----+---------+-------+
desc table_name;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
  • 2022-01-24
  • 2021-08-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案