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

Liệt kê cột của View MySQL bằng SHOW FULL COLUMNS

View là bảng ảo, cấu trúc giống bảng nên dùng SHOW FULL COLUMNS để liệt kê cột view.

Cú pháp

SHOW FULL COLUMNS FROM View_name;

Ví dụ

Xem cột view Info:

mysql> SHOW FULL COLUMNS FROM INFO\G
*************************** 1. row ***************************
  Field: ID
  Type: int(11)
  Collation: NULL
  Null: YES
  Key: 
  Default: NULL
  Extra: 
  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: 
*************************** 3. row ***************************
  Field: SUBJECT
  Type: varchar(20)
  Collation: latin1_swedish_ci
  Null: YES
  Key: 
  Default: NULL
  Extra: 
  Privileges: select,insert,update,references
  Comment: 
*************************** 4. row ***************************
  Field: ADDRESS
  Type: varchar(20)
  Collation: latin1_swedish_ci
  Null: YES
  Key: 
  Default: NULL
  Extra: 
  Privileges: select,insert,update,references
  Comment: 
4 rows in set (0.00 sec)