Syntax
CREATE VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
WHERE condition;
Example
CREATE VIEW employee_view AS
SELECT employee_id, first_name, last_name, salary
FROM employees
WHERE salary > 50000;
Explanation: This creates a view called employee_view
that includes only employees with a salary greater than 50,000. The view presents selected columns (employee_id
, first_name
, last_name
, salary
) from the employees
table.
Leave a Reply