articles

Home / DeveloperSection / Articles / View in SQL Server

View in SQL Server

Anonymous User8910 27-Jul-2010

A view is a list of columns or a series of records retrieved from one or more existing tables, or as a combination of one or more views and one or more tables. Based on this, before creating a view, you must first decide where its columns and records would come from. Obviously the easiest view is one whose columns and records come from one table.

Syntax for creating View

CREATE VIEW ViewName

AS

SELECT Statement

Example

CREATE VIEW view1

AS

SELECT * FROM Doctors

Opening or executing View

To open or execute View we use same statement as we use to use for viewing Table

records.

Example

SELECT * FROM view1

 View in SQL Server

Syntax for Modifying View

ALTER VIEW ViewName

AS

SELECT Statement

Example

ALTER VIEW view1

AS

SELECT * FROM Doctors WHERE ID>3

 View in SQL Server

Syntax for Deleting View

DROP VIEW ViewName

Example

DROP VIEW view1

 


Updated 20-Jan-2020
I am a content writter !

Leave Comment

Comments

Liked By