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

数据库数据库 2023-08-31 03:23:40 823
摘要: 语法SHOWFULLCOLUMNSFROMView_name;这里view_name是我们想要从中获取列列表的视图的名称。示例假设我们想要获取名为“Info”的视图的列列表,然后可以在以下查询的帮助下完成-mysql>SHOWFULLCOLUMNSFROMIN...

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

语法

SHOW FULL COLUMNS FROM View_name;

这里 view_name 是我们想要从中获取列列表的视图的名称。

示例

假设我们想要获取名为“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)

以上就是我们怎样才能像列出 MySQL 表的列一样列出 MySQL 视图的所有列呢?的详细内容,更多请关注其它相关文章!