Tuesday, 28 October 2014

Simple View



       If we crate a view on a single table, then the view is simple view. We can perform DML operation on simple view. Those operations will reflect on the base table.

Syntax:
CREATE VIEW <View Name>
AS
SELECT Column-1,Column-2,….., Column-N
FROM <Table Name>

Example:
Sample table creation:
CREATE TABLE Sample_Tbl (ID int, Name varchar(20))
INSERT INTO Sample_Tbl VALUES (1,'A')

View Creation:
CREATE VIEW Sample_View
AS
SELECT ID, NAME FROM  Sample_Tbl

No comments:

Post a Comment