CREATE OR REPLACE VIEW
CREATE OR REPLACE VIEW is a SQL statement in the Views category. Creates a new view or replaces an existing one (if the definition changed). The syntax is CREATE OR REPLACE VIEW view_name AS select_statement;. It returns created or replaced view. A typical example: CREATE OR REPLACE VIEW active_employees AS SELECT * FROM employees WHERE status = 'active' AND termination_date IS NULL; -- Creates if not exists, replaces if exists 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. Related Views entries: CREATE VIEW, DROP VIEW, ALTER VIEW, MATERIALIZED VIEW, WITH CHECK OPTION, INDEXED VIEW (WITH SCHEMABINDING), View WITH ENCRYPTION, View WITH READ ONLY.