Outdated Version
You are viewing an older version of this section. View current production version.
SHOW CREATE VIEW
Shows the CREATE VIEW statement that was used to create the view.
Syntax
SHOW CREATE VIEW view_name
Arguments
view_name
The name of the view.
Remarks
- The
Create Viewfield from the output can be used to recreate the view. - The output also contains information on
character_set_clientandcollation_connection. See List of Engine Variables for more information.
Example
The following example displays the output of SHOW CREATE VIEW.
CREATE VIEW count AS SELECT COUNT(*) FROM square WHERE num > 5;
SHOW CREATE VIEW count;
****
+-------+-------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
| View | Create View | character_set_client | collation_connection |
+-------+-------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
| count | CREATE DEFINER=`root`@`%` VIEW `count` AS SELECT COUNT(*) AS `COUNT(*)` FROM `square` as `square` WHERE (`square`.`num` > 0) | utf8 | utf8_general_ci |
+-------+-------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
Related Topics