From the course: Microsoft SQL Server 2016 Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create a view

Create a view - SQL Server Tutorial

From the course: Microsoft SQL Server 2016 Essential Training

Start my 1-month free trial

Create a view

- [Instructor] In this section, we're going to talk about using views in SQL Server 2016. Views provide an alternative way of looking at our data, a way that can be more convenient sometimes. I'm going to open the WideWorldImporters database. I'm going to open up the Tables. I'm going to look at the Application.Cities table. I'll right-click on that and go to Select Top 1000 Rows. And that'll show me how this data's structured. Each row has a column for CityName and StateProvinceID. So it doesn't actually have the name of the state. Instead it has an ID that links to the State table. And that is the correct way to set up a database. It is typically good to keep these items separated, keep cities separate from states and states separate from countries. But it also means if I want to look at the name of a city, and the name of a state, and the name of a country, I have to look at three different tables, and that can become a complex query to write to do something that actually should be…

Contents