Hey, I will call you back again to another video on my channel.
And in this video lecture, let's go ahead and look at the views that we will gain.
So in the previous lecture we were able to create a student attendance.
And we saw how that works out.
And now we have this employee table right in here.
You can go ahead and select uh all from employee.
So go ahead and select all from the employees.
And let's go ahead and see the table.
So we have these employees table right in here.
And what I just want to add something very important.
Let me say the employees email addresses.
So we can be able to search these employees by their email addresses.
And that data is going to be very very interesting.
So we're going to use that on the views and see how that actually works.
So I hope that's going to be interesting.
Now let's go ahead and uh create a column inside this table called the employees Email address.
So I hope that's going to be interesting guys.
So let's go ahead and.
Start off immediately.
So first of all I'll go right here.
Let's go ahead and bring this down.
So can we go to add a A column there.
So first of all we have to alter the table go or alter the table.
And the table name the employees.
And then we go ahead and add a column.
And let me say add a column.
And the column name is going to be email.
And it's going to be var data type.
So varchar.
And this is just going to be like t uh length.
And that is what we have.
Go ahead and update that.
And I have this email.
And I can see the email is null because there is no email address right in there.
Now after update the employee's email address with our respective emails.
So what I need to do right in here is to I have to remove whatever I have right in here and then go
ahead and uh, see update.
And then we go ahead and uh, update our Employees.
And what I need to do is to go ahead and set the email.
So go ahead and set email and then go ahead and put the very first one.
But before I put that let me go ahead and put a Where clause so I can go to know what I mean.
So put a Where clause.
We have the employees ID so we add employees ID is equal to one.
So now it can be able to understand what I'm doing.
So how to set the email and give the name of the email where employee ID is equal to one and employee
ID is.
So Michael.
All right.
So this is Michael.
And all I need to do is to go ahead and say Michael at gmail.com.
And then we go ahead and execute the query and check it out.
So Michael I'll go ahead and drag this open so Michael gmail.com.
And then I'll go ahead and change the next one.
And that is a Kizito at uh yahoo.com.
They'll go I had this idea to hold two and then we'll go ahead and execute our query.
Kizito at yahoo.com.
So the next ID is three.
And that is messy.
So when I say.
Messy at uh let's call this to be hotmail.
At hotmail.com.
And that is messy.
Now the next one is going to be judge at uh yahoo.com.
So the ID is four.
I go ahead and execute the query and that is it.
Then we have the next one is Steve.
And uh Steve the equal to 0.com.
And the ID is five or hidden updates that Steve.
And now the last one which is a memoir MLA um that's Gmail, that's com.
And then and the ID is six.
All right.
Go ahead and query.
Now we have added all this email addresses to the respective employees.
Now I want us to go ahead and create the views of this email.
So let's go ahead and create the views from the employee email.
So all I need to do is that I'll go ahead and uh, remove everything right in here.
Then I will remove these so that it doesn't get us confused.
So I go ahead and create a view.
So by the view what keyword.
Uh, views.
Go ahead and uh see employees underscore we say employees underscore email.
So that is the name of this view.
Employees underscore email address.
Then I'll go ahead and select this email as select the email because that is what we need.
So go ahead and make this to be lowercase because that is what I need.
And I'm going to select these from the employees table.
So go ahead and say from.
Employees.
So put semicolon at end and is a cutis.
Then let's go over here and check it out.
So we have views so created views called employees email us uh employee.
So as email.
And we selected us from the employees.
So over here let's go down and check it out so we can see we have one that views.
We now have our employees right in here and there.
We can see the email.
Now we want to show the email so the email can actually display for me.
What I need to do is go ahead and select everything and remove that.
I'll go ahead and say select uh all from.
Employees underscore email after the semicolon at the an end analysis refresh dot and drag this.
We can see emails and this is what we need.
So the view we created is for the email of the employees.
And with this we can actually go ahead and update our employees table to see if anytime we update the
table whether the email will actually be shown.
So from here you can actually populate this email.
You can use this email for marketing.
You can use that just to send them messages anytime.
Always go to your views table and take the email of the employees and message your employees.
I hope that is cool.
So let's go ahead and update our employees table and know if it if we update that the new email address
is going to input there, whether it will show right inside the views table without touching the views
table.
Let's go ahead and check it out.
So go over here and I'm going to say insert.
And I'm going to insert into employees.
So now we're starting to employees.
And we're going to insert the values.
And the values I'm going to insert is going to be start from ID is the workforce ID 1234567.
Inside ID seven.
And, uh, I'm going to insert the name.
Then we're going to set the name is Peter.
All right.
So go ahead and say Peter.
And uh, the next one is the GP.
And he has a GPA of 4.6.
And, uh, the referrer is going to be.
No.
And then the email address which we put is going to be Peter at, let me say given a name, maybe hotmail
hotmail.com.
And that is all.
So why not put semicolon at the end of this and go ahead and refresh this and let's check it out.
So we've corrected that.
Now we first of all go ahead and uh check out.
So go ahead and select uh all flown wireless from the employees on the email.
Go ahead and refresh this and then you can see you have Peter at yahoo.com Yahoo Mail.com.
All right.
So we did not touch the emails employee underscore email taboo which is the view taboo.
But whatever we did in the employee table actually reflected on the employees email because this is
immutable of the employees table.
So if go and select this on that employee.
So then you see Peter right in there.
Go ahead and check this out.
And you can see that Peter is here.
And it's actually reflected on the employees underscore email views.
So I have a nice cool quiet practice with its run and check on docs.
And if you have any questions you go ahead and use the question and answer section.
And I'm going to get back to you as soon as possible.
Thank you so much.
And I'm going to see you in the next video lecture.