As we know that views are a type of virtual tables and are the composition of tables too hence we can use the same query to get the definition of a view which we use to get the definition of a table. In other words, we can use SHOW CREATE statement to get the definition of a MySQL view. Its syntax would be as follows −
Syntax
SHOW CREATE VIEW view_name;
Here view_name is the name of the view of which we want to get the definition.
Example
The following query will give the definition of a view named ‘info’ −
mysql> Show Create View Info\G *************************** 1. row *************************** View: info Create View: CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `info` AS select `student_info`.`id` AS `ID`,`student_info`.`Name` AS `NAME`,`student_info`.`Subject` AS `SUBJECT`,`student_info`.`Address` AS `ADDRESS` from `student_info` character_set_client: cp850 collation_connection: cp850_general_ci 1 row in set (0.00 sec)