Did you find this useful?
Socialize it today.


SQL CREATE VIEW Statement

Tuesday, January 03, 2012

tags SQL

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



employeeIDemployeeNamehireDate
1745Bob White03/15/2011
2337Jessie Richards07/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.

Please help us spread the word by socializing it today!

email contact us

Did you find something wrong with the information on this page? Please take a moment to report it to us so that we can continue to improve the quality of the information on this site. Click here to report an issue with this page.



Recommended Books & Training Resources

SQL Cookbook Head First SQL: Your Brain on SQL A Learners Guide