Views

Views are saved queries that we can use when creating more complex queries to avoid unnecessary complications.


-- Creating a view
CREATE VIEW view_name AS SELECT * FROM table_name;

-- Using a view in a query
SELECT * FROM view_name;

-- Altering a view
ALTER VIEW view_name AS SELECT * FROM table2_name;

--  Displaying the code of a view
SHOW CREATE VIEW view_name;

-- Deleting a view
DROP VIEW view_name;