SHOW CREATE VIEW
SHOW CREATE VIEW viewUse this statement to display an SQL statement that can be used to create a view like the one named. The results may be copied and used with another database. You can also copy the results and modify the name of the view so that the statement may be used to create a similar or identical view on the same database. This statement is available as of version 5.0.1 of MySQL:
SHOW CREATE VIEW student_directory \G
*************************** 1. row ***************************
View: student_directory
Create View: CREATE ALGORITHM=UNDEFINED
DEFINER='russell'@'localhost' SQL SECURITY INVOKER
VIEW 'student_directory'
AS SELECT 'students'.'student_id' AS 'ID',
CONCAT('students'.'name_first',
convert(repeat(_utf8' ',1) using latin1),
'students'.'name_last') AS 'Name',
'students'.'phone_home' AS 'Telephone'
FROM 'students'This view is the same one created in the example given for the
CREATE VIEW statement earlier. Notice that the
database name (personnel) has been added to the end
of the view name (employee_directory).