Simple vs Complex Views

  • Simple Views: based on one table, no functions, can be updated.
  • Complex Views: may use joins, group functions, subqueries; may not be directly updatable.
-- Simple view
CREATE VIEW emp_names AS SELECT first_name FROM employees;

-- Complex view
CREATE VIEW emp_summary AS 
SELECT department_id, AVG(salary) AS avg_sal 
FROM employees 
GROUP BY department_id;