ShowCreateViewInfo\G******************************1.row *****"/> ShowCreateViewInfo\G******************************1.row *****">
Home >Database >Mysql Tutorial >How can we get the definition of a MySQL view the same way we get the definition of a MySQL table?
We know that a view is a virtual table and a combination of tables, so we can use the same query to get the definition of the view, and then use the definition of the view to get the view The definition of a table. In other words, we can use the SHOW CREATE statement to get the definition of a MySQL view. Its syntax is as follows -
SHOW CREATE VIEW view_name;
Here view_name is the name of the view whose definition we want to get.
The following query will give a view defined 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)
The above is the detailed content of How can we get the definition of a MySQL view the same way we get the definition of a MySQL table?. For more information, please follow other related articles on the PHP Chinese website!