INFORMATION_SCHEMA 数据库有一个 VIEWS 表,其中包含视图元数据,即有关视图的数据。为了说明这一点,我们以名为“Info”的视图为例。
示例
以下查询将显示名为“Info”的视图的元数据“信息”-
mysql> SELECT * from INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'Info' AND TABLE_SCHEMA = 'query'\G
*************************** 1. row ***************************
TABLE_CATALOG: def
TABLE_SCHEMA: query
TABLE_NAME: info
VIEW_DEFINITION:select`query`.`student_info`.`id`AS`ID`,`query`.`student_info`.`Name` AS `NAME`,`query`.`student_info`.`Subject` AS `SUBJECT`,`query`.`
student_info`.`Address` AS `ADDRESS` from `query`.`student_info`
CHECK_OPTION: NONE
IS_UPDATABLE: YES
DEFINER: root@localhost
SECURITY_TYPE: DEFINER
CHARACTER_SET_CLIENT: cp850
COLLATION_CONNECTION: cp850_general_ci
1 row in set (0.00 sec)