Support our 100% FREE Projects: Donate Now OR Sponsor Now


  

SQL CREATE VIEW Syntax

In this SQL Server 2012 tutorial I will show you how create view with syntax using Microsoft SQL Server Management. For the purpose of this tutorial I will use AdventureWorksDW2012.

Note: We have video version of this tutorial. Please click the button below otherwise scroll down to read text based tutorial.

Subscribe to me on YouTube

Other Versions of SQL Server:

  • SQL Server 2012
    • This blog post has been written using SQL Server  2012
  • SQL Server  2008 / R2
    • The examples we used should work in SQL Server 2008 and R2
  • SQL Server 2005
    • We suspect that this will work in SQL Server 2005 as well

 

In Management Studio I will use AdventureWorksDW2012. Next we have to click Tables and select dbo.DimCustomer. Picture below show us this steps.

SQL Create View AdventureWorksDW2012 DimCustomer

At the beginning of this example we have to create a New Query. You have two options to select AdventureWorksDW2012. You can select from the drop down box or you can use statement. 

SQL Create View AdventureWorksDW2012 select

At the new Query I select use and drag AdventureWorksDW2012. Now, I will show each steps in this Query.

Below the use AdventureWorksDW2012 I type: GO, below CREATE VIEW and vCustomer.

SQL Create View AdventureWorksDW2012 new Query

In the next steps I will type AS and below I will type condent of this View -  type SELECT and drop from Column Title, FirstName and LastName.

SQL Create View AdventureWorksDW2012 select names

Next I will type FROM and drop dbo.DimCustomer. I execute a Query and in a message box our Query should be Execute successfully.

SQL Create View AdventureWorksDW2012 DimCustomer

SQL Create View AdventureWorksDW2012 Customer

In the View folder we should see our new view. If you cannot see this just click at the folder View and refresh - now It should be right.

I hope this SQL Tutorial was helpful.

Take Care,

Katie and Emil

Share: Share on FacebookShare on Google PlusTweet it
Comments Add Comment
No data was returned. Share your thoughts, questions and suggest improvements:
Add Comment

You found us! Below are 50 most popular searched keywords

created at TagCrowd.com

Disclaimer: While every caution has been taken to provide our readers with most accurate information and honest analysis, please use your discretion before taking any decisions based on the information in this blog. Author will not compensate you in any way whatsoever if you ever happen to suffer a loss/inconvenience/damage because of/while making use of information in this blog.