A SQL view functions as a table but is dynamic in nature. SQL views contain rows and columns just like a table. Views are created from one or more tables that belong to their respective databases.
Syntax
CREATE VIEW viewName AS
SELECT columnName1, columnName2,
FROM tableName
|
Example
CREATE VIEW newEmployees AS
SELECT employeeID, employeeName, hireDate
FROM Employees
WHERE hireDate > '01/01/2011'
|
Results
employeeID | employeeName | hireDate |
1745 | Bob White | 03/15/2011 |
2337 | Jessie Richards | 07/06/2011 |
The CREATE VIEW Statement used in this example created a view with three columns from the source table called Employees. You can now use
standard SQL Queries to retrieve data from this view.
Did you find the page informational and useful? Share it using one of your favorite social sites.
Recommended Books & Training Resources