Monday, February 8, 2010

SQL CREATE VIEW - Introduction and syntax

Explain the SQL CREATE VIEW statement. Write SQL syntax for the SQL CREATE VIEW statement along with an example.

SQL CREATE VIEW: A view is a virtual table. A view 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.

Syntax:
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition

Example:
CREATE VIEW [sample] AS
SELECT employeeID,employeeName
FROM employee
WHERE salary > 10000

No comments:

Post a Comment