A view is a virtual table based on a SQL query.
It does not store data but shows results from underlying tables.
CREATE VIEW high_salary_employees AS
SELECT name, salary
FROM employees
WHERE salary > 50000;SELECT * FROM high_salary_employees;CREATE OR REPLACE VIEW high_salary_employees AS
SELECT name, salary
FROM employees
WHERE salary > 60000;DROP VIEW high_salary_employees;CREATE VIEW employee_departments AS
SELECT e.name, d.department_name
FROM employees e
JOIN departments d
ON e.department_id = d.id;CREATE VIEW employee_summary AS
SELECT name, salary
FROM employees;
SELECT * FROM employee_summary;Create a view and query it.
CREATE VIEW my_view AS
SELECT * FROM table_name;
SELECT * FROM my_view;Ask the AI if you need help understanding or want to dive deeper in any topic