softwaretips4u Tips that Transform
← Back to Homepage ← Back to Articles

SQL Views

A view is a virtual table based on the result of a query. It does not store data itself, but displays data from underlying tables.

1️⃣ Creating a View

CREATE VIEW employee_salaries AS
SELECT name, dept_id, salary
FROM employees
WHERE salary > 50000;

-- Query like a table
SELECT * FROM employee_salaries;

2️⃣ Updating a View

CREATE OR REPLACE VIEW employee_salaries AS
SELECT name, dept_id, salary
FROM employees
WHERE salary > 60000;

3️⃣ Dropping a View

DROP VIEW employee_salaries;

4️⃣ Advantages of Views

5️⃣ Limitations

← Back to Articles | 🏠 Back to Homepage