SELECT*fromINFORMATION_SCHEMA.VIEWSWHERETABLE_NAME='Info'ANDTABLE_SCHEMA='query'\G****************** **********"/> SELECT*fromINFORMATION_SCHEMA.VIEWSWHERETABLE_NAME='Info'ANDTABLE_SCHEMA='query'\G****************** **********">
INFORMATION_SCHEMA The database has a VIEWS table that contains view metadata, that is, data about the view. To illustrate this, let's take a view named "Info" as an example.
The following query will display the metadata "Info" for a view named "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)
The above is the detailed content of How can we view the metadata of a view stored in a specific MySQL database?. For more information, please follow other related articles on the PHP Chinese website!