How can we see the metadata of a view(s) stored in a particular MySQL database?


The INFORMATION_SCHEMA database has a VIEWS table that contains view metadata i.e. data about views. To illustrate it we are taking the example of a view named ‘Info’.

Example

The following query will show the metadata of 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)

Lakshmi Srinivas
Lakshmi Srinivas

Programmer / Analyst / Technician

Updated on: 22-Jun-2020

135 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements