View in Sql Server
View in Sql Server
- View is a virtual table
- It s contains columns and data in different table
- View does not contain any data directly. Its a set of select query
Table 1
Sno
Sname
|
Table 2
Sno
Lname
|
View_table1_table2
Sname
Lname
|
Syntax
CREATE VIEW JS_VIEW_NAMEAS
[SELECT STATEMENT]
Why we are use View ?
View is used for security mechanism .if you restricted particular column for users .
Sql Server Syntex for View
CREATE VIEW
CREATE VIEW JS_VIEW
AS
SELECT *FROM STUD A,LIB L WHERE A.SNO=L.SON
ALTER VIEW
ALTER VIEW JS_VIEW
AS
SELECT *FROM STUDENTTABLE A,LIB L WHERE A.SNO=L.SON
SELECT VIEW
SELECT*FROM JS_VIEW
DROP VIEW:
DROP VIEW JS_VIEW
Sql Server Syntex for View
CREATE VIEW
CREATE VIEW JS_VIEW
AS
SELECT *FROM STUD A,LIB L WHERE A.SNO=L.SON
ALTER VIEW
ALTER VIEW JS_VIEW
AS
SELECT *FROM STUDENTTABLE A,LIB L WHERE A.SNO=L.SON
SELECT VIEW
SELECT*FROM JS_VIEW
DROP VIEW:
DROP VIEW JS_VIEW
0 Comments