FreeJobAlert.Com

Government Jobs | Results | Admit Cards

sqlserver interview questions | Views

What is view in SQL Server?
View is one of the database objects and act as virtual table. View contains SQL statements with specifics and stores in SQL Server.

What is the syntax to create view in SQL Server?
CREATE VIEW [ schema_name . ] view_name [ (column [ ,…n ] ) ]
[ WITH [ ,…n ] ]
AS select_statement [ ; ]
[ WITH CHECK OPTION ]

What are the advantages of views?

  • Views enable the developers to write common queries once as view use them in application.
  • User could able to access subset of data contained base tables (restricted tables) by using view.
  • Performance would be increased to complex queries by creating indexes on views.

What are the restrictions to view select statement?

  • Developer should not use INTO keyword
  • We should not Reference to a temporary table or table variable
  • We should not use COMPUTE or COMPUTE BY clause

What is the difference between a regular view and an indexed view?
A regular view is a SELECT statement that is referenced by a name and stored in SQL Server. It does not contain any data.

An indexed view is a view that has a clustered index created against it, which causes SQL Server to store the results of the query defined in the view on disk. An indexed view must meet very stringent requirements for the view, the base tables that the view references, and the index on the view.

If you would like to view all SQL Server related topics click below link
SQL Server related topics

Tags: SQL Server, sql server view benefits, sql server view syntax, sql server views advantages, sqlserver view, views in sql, views in sql server, views in sql server 2000, views in sql server 2005, views in sql server 2008

Leave a Comment