CREATE VIEW
CREATE VIEW is a SQL statement in the Views category. Creates a virtual table based on a SELECT query. Think of it as a saved query that acts like a table. The syntax is CREATE [OR REPLACE] VIEW view_name AS select_statement;. It returns view object. A typical example: CREATE VIEW high_earners AS SELECT name, salary, department FROM employees WHERE salary > 80000; -- Query the view like a table: SELECT * FROM high_earners ORDER BY salary DESC; 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. A close relative is MATERIALIZED VIEW, which a view that physically stores the result. Unlike regular views, querying it does NOT re-execute the query. More about this category: Database views — CREATE VIEW, DROP VIEW, ALTER VIEW, materialized views.