Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> MySQL

Cách xem thông tin chi tiết cột hơn DESCRIBE/EXPLAIN/SHOW COLUMNS trong MySQL


Dùng câu lệnh SHOW FULL COLUMNS để lấy thông tin chi tiết hơn so với DESCRIBE, EXPLAIN, SHOW COLUMNS.

Cú pháp

SHOW FULL COLUMNS from Table_name;

Ví dụ

mysql> SHOW FULL COLUMNS FROM EMPLOYEE\G;
*************************** 1. row ***************************
Field: ID
Type: int(11)
Collation: NULL
Null: NO
Key: PRI
Default: NULL
Extra: auto_increment
Privileges: select,insert,update,references
Comment:
*************************** 2. row ***************************
Field: Name
Type: varchar(20)
Collation: latin1_swedish_ci
Null: YES
Key:
Default: NULL
Extra:
Privileges: select,insert,update,references
Comment:
2 rows in set (0.04 sec)

Thông tin bổ sung so với DESCRIBE:

  • Collation: Quy tắc sắp xếp/so sánh ký tự
  • Privileges: Quyền hạn trên cột (select, insert, update, references)
  • Comment: Chú thích cột (nếu có)
Dùng \G để hiển thị dọc dễ đọc khi nhiều cột.