Friday, June 8, 2012

SQL Views

A view is a virtual table based on the result set of an SQL statement.


It contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.


SQL CREATE VIEW Syntax


CREATE VIEW [view_name] AS
SELECT column_name (s)
FROM table_name
WHERE --condition


SQL CREATE VIEW Examples


CREATE VIEW [ActiveEmpList] as
SELECT EmpId, EmpName, EmpDesignation
FROM Employee
WHERE IsActive = 1

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.