CREATE VIEW is a Data Definition Language (DDL) command used to create a virtual table based on the result of a SQL query. A view stores only the SQL query, not the actual data. Whenever the view is queried, the database executes the underlying SELECT statement and returns the latest data.
Views simplify complex queries, improve security by exposing only required columns, and allow developers to reuse the same business logic without rewriting SQL statements.
A company creates a view that displays only active employees so managers can generate reports without seeing resigned employees.
CREATE VIEW ActiveEmployees AS
SELECT
EmployeeID,
EmployeeName,
Department,
Salary
FROM Employees
WHERE Status = 'Active';
CREATE VIEW is widely used in reporting systems, HR dashboards, banking applications, ERP software, healthcare systems, CRM platforms, and business intelligence solutions.
- Creates a virtual table.
- Stores the SQL query instead of data.
- Simplifies complex queries.
- Improves security by hiding unnecessary columns.
- Provides reusable business logic.
- Always displays the latest data.
- Can be queried like a normal table.
Which SQL statement creates a View?
The CREATE VIEW statement is used to create a virtual table.
Does a View store data physically?
No. A standard View stores only the SQL query definition.