SHOW CREATE VIEW
SHOW CREATE VIEW is a SQL statement in the Views category. MySQL: shows the CREATE VIEW statement that defines the specified view. The syntax is SHOW CREATE VIEW view_name;. It returns cREATE VIEW statement. A typical example: SHOW CREATE VIEW high_earners; -- CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW -- `high_earners` AS select ... -- Useful for: -- Documenting view definitions -- Duplicating views across environments -- Understanding what a view does A close relative is CREATE VIEW, which creates a virtual table based on a SELECT query. Think of it as a saved query that acts like a table. A close relative is DROP VIEW, which removes a view from the database. Does not affect the underlying tables. A close relative is ALTER VIEW, which modifies an existing view definition. More about this category: Database views — CREATE VIEW, DROP VIEW, ALTER VIEW, materialized views.