SQL Server

Views

where ever we use a select statement we get some kind of resultset. in order to save our time sql provides a functionality to save such queries as views so Views are basically stored queries.

Views has many advantages:

  1. Save time as we don’t have to write the same queries again and again
  2. It helps to have a better security view as we can restrict the direct access to certain users and we can give access to the views which they require
  3. Views can hide the structure of the tables.

How to create a new view:

  1. Create view <Viewname>
  2. as
  3. select * from <TableName>

how to access view:

  1. select * from <ViewName>

Leave a Reply

Your email address will not be published. Required fields are marked *