我们怎样才能像列出 MySQL 表的列一样列出 MySQL 视图的所有列呢?

我们怎样才能像列出 MySQL 表的列一样列出 MySQL 视图的所有列呢?

语法

SHOW FULL COLUMNS FROM View_name;登录后复制

示例

假设我们想要获取名为“Info”的视图的列列表,然后可以在以下查询的帮助下完成 -

mysql> SHOW FULL COLUMNS FROM INFOG *************************** 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)登录后复制