Home » Interview Q&A » View in sql

View in sql

default constraint in sql
Kill Processes in sql server 2008

Hey folks till now we have discussed User defined functions in sqlKill Processes in sql server 2008, default constraint in sql , Remove Cross duplicate rows in SQLRecursive SQL Query , Recursive SQL Query-2STUFF and CONCAT in SQLRANK in SQL server , Difference between temporary table and table variable in sql serverUNIQUEIDENTIFIER in SQL ServerRAW Mode with FOR XML , AUTO Mode with FOR XMLEXPLICIT Mode with FOR XML , PATH Mode with FOR XMLOUTPUT Clause in SQL ServerDifference between delete and truncate in sql server etc.

Today we will discuss regarding View. A view is a virtual table which contains columns from one or more table.  A view don’t have any data in it. A view is nothing more than the collection of columns from one or more table in the form of select query.  A complex view may contains the data from many tables.

Syntax : 

SELECT column_name_1,column_name_2
FROM table WHERE condition

A view always shows up-to-date data. Each time user queries the view the data base engine recreates the data using the view’s SQL statement.

So lets go through the below example to create, update and drop view.

Suppose i have two tables of employee. One is employee which contains name,address and etc. The other table is employee details which contains salary, age ,department and other financial details.

Now lets create a simple view with the use of above listed tables which don’t include the Salary and PANNumber from EmployeeDetails table.

So after creating above view the output of below query is as below.




Update View

We can  modify the definition of a SQL VIEW without dropping it by using the SQL ALTER Statement.



We can drop the SQL view with the help of SQL DROP statement.





Hello friends, My self Dhruv Sheth, I have more than 6 years of Industrial experience as a Software Developer. In my career I got chance to work with asp.net, c#,Web API, JavaScript, JQuery, WPF, WCF , Windows Application, PostScript, vb.net, GhostScript etc. So I have decided to share my knowledge with everyone and finally I have come up with TechnoThirsty.

Leave a Reply

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


Time limit is exhausted. Please reload CAPTCHA.

The content is copyrighted to technothirsty.com and may not be reproduced on other websites without permission from the owner.You may contact us using the information below.