okay next uh we're going to make uh a
view a view is like a query except it
becomes a permanent part of the database
notice uh in the data in the database
there's the tables and then below here
there's views right now we don't have
any so there's two ways to make a view
uh you can open up a normal query and
then put the words create view up top as
follows I'm going to pick on file open
file
and then we're going to go into one
that's actually called create view as we
can see notice how it's a normal query
except up top it says create View and it
has the view name as and then you just
have your regular U SQL statements there
so we're going to run
this notice when you run it it actually
doesn't run the select all right it just
creates The View so we're going to close
that
now and now if we right click on views
and go ahead and refresh
that then uh we're going to see the
actual view now if you want it to run
that you're going to right click on it
and um actually what we can
do is uh select the top 100 top 100 rows
and that'll actually run The View but
now the view is actually permanent part
of the database when the view runs uh it
it does refresh the uh the query so you
would you would see the freshest data at
that time and now you can really use
that as a data source like any table uh
uh you know it really is a permanent
structure in the database it's actually
a when I say it's a permanent structure
the view is there but every time the
view runs it re it requies the table
uh the second way to make a view is as
follows we're going to close this window
uh now we're going to go to where it
says views on the database Explorer
we're going to right click on views and
pick on New
View now notice how this is going to be
the the same visual screen that we saw
when we made a query in design view a
few examples back so in this case we can
start to pick our
tables as as we wanted
to and then start to pick our Fields uh
from our tables as we did
[Music]
before uh maybe we'll use the U the ship
country in the order amount I want to
pick the product ID the unit price and
the quantity from the products table I
like to get the product name now one
thing we really need to do is tie these
tables together so I'm going to pick up
the order ID and drag it over to the
order ID over here and then these two
tables are linked by the product
ID now we should be able to um now we
should be able to close the
window we we'll save the
view and we'll call this
one uh orders with details and product
names now we're going to right click on
views actually it shows up here we're
going to right click on The View pick on
select that'll actually run the view and
in this case you can see we have
information from the order table the
order details and also from the product
here so that's what a view is a is this
really going to be a query that we make
into a permanent structure into the
database