Hello there.
Welcome to this video in this video.
I will be introducing you to what views are in Oracle and explain some of the reasons why they are used.
I will also create an example view.
What is his view.
Basically if you is stored secure query or sequal query so we can be a combination of one or more tables.
So a view is a logical representation of one or more tables a view derives data from tables and tables
unknown as base tables so a base table can also be other tables or other views.
Any operations that are performed on views actually do affect the base tables as well.
One of the reasons why we use views we use them to tailor the presentation of data to different type
of users.
So you may have several users within the organizations.
You may want them to see certain part of the data in a table or tables so you can use to section out
the information you want to portray to different type of users views also provide an additional level
of security to the tables.
By restricting access to sit in rows of columns in a table you may have a table that have salary information
that you may not want certain users to see so you can use it view to exclude the salary part of the
information on like a table view is not a located storage space.
Also in view does not contain data.
All it does is display the data in view is also stored in the Oracle database data dictionary.
I have turned toward for a call edit open so we are going to create an example view together.
I am gonna have a look at the Employees Table and see what it looks like at the moment and then from
the date I remember I am going to create a view.
So lets have a look.
The employees table with this select statement.
So let
start start means bring back everything from
employees.
Employees mean the meaning the table and then a call on.
Always remember to end your statements with a semicolon because he separates it from other statements
are right so the school query here return is select which means bring back the start.
Means all data from employees employees is to table.
So if that execute this
source give me a hundred and seven rolls from this table here.
These are the different columns you got.
Employee.
The first name last name got so many.
If you want to find out the structure of the table what this table looks like he can use to describe
common to you describe on the table describe
employees so miquel So this would give it a strong shot.
I run that.
Think about it.
All right so this is the structure of the table.
These are the columns columns of the table and in different aspects of the table.
So if ever you want to find out what the table structure looks like or check the columns you can use
the Describe command to do that.
Okay let's go back to our first query around that again.
All right so I'm going to create a view from this table.
I'm going to restrict some of the data and won't exclude the salary aspect of it be comissioner percent.
And if you or that just to make certain data available only to certain people so to do that you start
to create comite for you to be able to view the account you are using needs to have b Create permission
to do that.
So this account has the permission to do that.
The account I'm using which is here char count.
If you all who haven't got that you need to grant that account permission to do that using the grant
permission.
So I'm just going to create a view it creates
with a word create and then view
and then the view name
the view may well be OnStar has as mean.
This is where you're going to take the information from.
I need to specify where the information is coming from.
So from this so take what's left.
So I'm trying to get the data I want to use for the view.
And I do that using the select statements for selecting employees Heidi.
And then come up you have to come out to separate the columns.
You don't have to use upper case.
I'm just using up a case for simplicity so you can always use lower case if you want to.
And then last name.
And what else do I need.
Limited email address.
Let's say hi a date.
T.
Department Heidi Hyatt date.
No I think I'll leave it like that.
Ah lamb and a phone number.
I mean to phone
the score.
No no it is when you are adding the columns always specify columns the way they are in the table.
For example the phone number Colombia.
That's an on the score.
So I have to specify on the score as well.
So these are the columns I want to show up in my view.
So I need to specify the table they're coming in from from
employees.
All right so my view is good to go.
So we've said create a view and call it all staff as means take the information from this table here.
This cell let me these is what I want you to include in the view and from these employees or the employees
now is the base table.
So if I run this is just great of you.
So I click execute.
Excellent.
You see that there is a view created you created.
So I've got a view.
So if I do a select statement on that.
So I do select a star from start
fire run that it should give me a new view.
Excellent.
You see that so this is the view we've created.
Employee the last name email hire date phone number or is derived from this script here.
And these the details were taken from the employees so the employees is the base table saw with this
view.
Now we can make this data available to certain types of users within the organization and then we can
also tailor a different type of view to a different set of users.
So this is the advantage of using a view.
So we restricted the salary information.
We was present in the base table from this all stuff.
Just a quick summary of what I've covered in this video.
I explained what your views are.
They are stored in school queries the data from the queries are taken from tables.
Could be one or more tables and table the date has taken from there known as base tables view as all
source can be used to customize data to present a different type of user.
They can also be used to restrict access from parts of the data from certain parts of the data to other
people.
The views are stored in the data dictionary.
We also create an example for you.
I hope the information in this video has been helpful.
You can practice creating some views for yourself.
Thank you so much for watching.
Bye for now.