SHOW CREATE VIEW
Descriptionβ
Display the CREATE VIEW statement used to create the specified view.
Syntaxβ
SHOW CREATE VIEW <name>
Required Parametersβ
**<name>**
The name of the view to view.
Result Descriptionβ
- View: The name of the queried view.
- Create View: The persisted SQL statement in the database.
- character_set_client: The value of the character_set_client system variable in the session when the view was created.
- collation_connection: The value of the collation_connection system variable in the session when the view was created.
Access Control Requirementsβ
Users executing this SQL command must have at least the following privileges:
Privilege | Object | Notes |
---|---|---|
SHOW_VIEW_PRIV | Table |
View information can also be queried via the INFORMATION_SCHEMA.VIEWS table.
Examplesβ
CREATE VIEW vtest AS SELECT 1, 'test';
SHOW CREATE VIEW vtest;
Query result:
+-------+------------------------------------------+----------------------+----------------------+
| View | Create View | character_set_client | collation_connection |
+-------+------------------------------------------+----------------------+----------------------+
| vtest | CREATE VIEW `vtest` AS SELECT 1, 'test'; | utf8mb4 | utf8mb4_0900_bin |
+-------+------------------------------------------+----------------------+----------------------+