WEBVTT

00:07.790 --> 00:10.670
Hey, I will call you back again to another video on my channel.

00:10.670 --> 00:15.950
And in this video lecture, let's go ahead and look at the views that we will gain.

00:15.950 --> 00:19.100
So in the previous lecture we were able to create a student attendance.

00:19.100 --> 00:20.630
And we saw how that works out.

00:20.630 --> 00:23.450
And now we have this employee table right in here.

00:23.480 --> 00:28.670
You can go ahead and select uh all from employee.

00:28.700 --> 00:33.140
So go ahead and select all from the employees.

00:33.140 --> 00:34.820
And let's go ahead and see the table.

00:34.940 --> 00:37.310
So we have these employees table right in here.

00:37.310 --> 00:39.830
And what I just want to add something very important.

00:39.860 --> 00:43.190
Let me say the employees email addresses.

00:43.370 --> 00:46.700
So we can be able to search these employees by their email addresses.

00:46.700 --> 00:49.340
And that data is going to be very very interesting.

00:49.340 --> 00:53.090
So we're going to use that on the views and see how that actually works.

00:53.090 --> 00:54.860
So I hope that's going to be interesting.

00:54.890 --> 01:03.140
Now let's go ahead and uh create a column inside this table called the employees Email address.

01:03.140 --> 01:04.910
So I hope that's going to be interesting guys.

01:04.910 --> 01:06.800
So let's go ahead and.

01:07.010 --> 01:08.420
Start off immediately.

01:08.810 --> 01:10.910
So first of all I'll go right here.

01:10.940 --> 01:12.200
Let's go ahead and bring this down.

01:12.200 --> 01:16.370
So can we go to add a A column there.

01:16.370 --> 01:20.180
So first of all we have to alter the table go or alter the table.

01:20.180 --> 01:23.450
And the table name the employees.

01:23.450 --> 01:27.350
And then we go ahead and add a column.

01:27.350 --> 01:30.590
And let me say add a column.

01:30.590 --> 01:33.320
And the column name is going to be email.

01:33.350 --> 01:35.630
And it's going to be var data type.

01:35.630 --> 01:36.410
So varchar.

01:36.650 --> 01:41.480
And this is just going to be like t uh length.

01:41.480 --> 01:43.130
And that is what we have.

01:43.160 --> 01:44.210
Go ahead and update that.

01:44.210 --> 01:45.380
And I have this email.

01:45.380 --> 01:50.060
And I can see the email is null because there is no email address right in there.

01:50.090 --> 01:54.140
Now after update the employee's email address with our respective emails.

01:54.140 --> 01:58.550
So what I need to do right in here is to I have to remove whatever I have right in here and then go

01:58.550 --> 02:02.210
ahead and uh, see update.

02:02.300 --> 02:07.390
And then we go ahead and uh, update our Employees.

02:07.630 --> 02:12.520
And what I need to do is to go ahead and set the email.

02:12.520 --> 02:18.190
So go ahead and set email and then go ahead and put the very first one.

02:19.090 --> 02:23.470
But before I put that let me go ahead and put a Where clause so I can go to know what I mean.

02:23.470 --> 02:24.490
So put a Where clause.

02:24.520 --> 02:30.730
We have the employees ID so we add employees ID is equal to one.

02:30.730 --> 02:32.800
So now it can be able to understand what I'm doing.

02:32.800 --> 02:38.230
So how to set the email and give the name of the email where employee ID is equal to one and employee

02:38.260 --> 02:39.580
ID is.

02:39.580 --> 02:41.470
So Michael.

02:41.650 --> 02:42.130
All right.

02:42.130 --> 02:43.330
So this is Michael.

02:43.330 --> 02:51.070
And all I need to do is to go ahead and say Michael at gmail.com.

02:51.070 --> 02:53.530
And then we go ahead and execute the query and check it out.

02:53.530 --> 02:58.120
So Michael I'll go ahead and drag this open so Michael gmail.com.

02:58.120 --> 03:00.520
And then I'll go ahead and change the next one.

03:00.520 --> 03:07.510
And that is a Kizito at uh yahoo.com.

03:07.510 --> 03:13.060
They'll go I had this idea to hold two and then we'll go ahead and execute our query.

03:13.090 --> 03:15.160
Kizito at yahoo.com.

03:15.160 --> 03:16.540
So the next ID is three.

03:16.540 --> 03:18.100
And that is messy.

03:18.100 --> 03:19.510
So when I say.

03:21.550 --> 03:27.670
Messy at uh let's call this to be hotmail.

03:29.890 --> 03:31.510
At hotmail.com.

03:32.140 --> 03:33.880
And that is messy.

03:33.910 --> 03:42.880
Now the next one is going to be judge at uh yahoo.com.

03:42.880 --> 03:45.460
So the ID is four.

03:45.580 --> 03:48.580
I go ahead and execute the query and that is it.

03:48.670 --> 03:51.430
Then we have the next one is Steve.

03:51.820 --> 03:58.090
And uh Steve the equal to 0.com.

03:58.090 --> 04:03.760
And the ID is five or hidden updates that Steve.

04:03.760 --> 04:15.190
And now the last one which is a memoir MLA um that's Gmail, that's com.

04:15.190 --> 04:18.280
And then and the ID is six.

04:18.820 --> 04:19.180
All right.

04:19.180 --> 04:20.410
Go ahead and query.

04:20.440 --> 04:24.400
Now we have added all this email addresses to the respective employees.

04:24.430 --> 04:30.820
Now I want us to go ahead and create the views of this email.

04:30.820 --> 04:33.070
So let's go ahead and create the views from the employee email.

04:33.070 --> 04:36.940
So all I need to do is that I'll go ahead and uh, remove everything right in here.

04:37.120 --> 04:41.560
Then I will remove these so that it doesn't get us confused.

04:42.160 --> 04:45.370
So I go ahead and create a view.

04:45.370 --> 04:47.260
So by the view what keyword.

04:47.290 --> 04:48.190
Uh, views.

04:48.400 --> 04:55.960
Go ahead and uh see employees underscore we say employees underscore email.

04:57.520 --> 05:00.130
So that is the name of this view.

05:00.130 --> 05:02.680
Employees underscore email address.

05:02.860 --> 05:10.180
Then I'll go ahead and select this email as select the email because that is what we need.

05:10.180 --> 05:15.210
So go ahead and make this to be lowercase because that is what I need.

05:15.210 --> 05:19.320
And I'm going to select these from the employees table.

05:19.320 --> 05:22.200
So go ahead and say from.

05:24.750 --> 05:25.560
Employees.

05:25.560 --> 05:28.530
So put semicolon at end and is a cutis.

05:28.560 --> 05:33.090
Then let's go over here and check it out.

05:33.090 --> 05:41.370
So we have views so created views called employees email us uh employee.

05:41.400 --> 05:42.750
So as email.

05:42.750 --> 05:45.600
And we selected us from the employees.

05:45.600 --> 05:51.480
So over here let's go down and check it out so we can see we have one that views.

05:51.480 --> 05:55.890
We now have our employees right in here and there.

05:55.890 --> 05:57.150
We can see the email.

05:57.180 --> 06:01.080
Now we want to show the email so the email can actually display for me.

06:01.110 --> 06:04.260
What I need to do is go ahead and select everything and remove that.

06:04.290 --> 06:09.150
I'll go ahead and say select uh all from.

06:12.270 --> 06:19.320
Employees underscore email after the semicolon at the an end analysis refresh dot and drag this.

06:19.350 --> 06:21.720
We can see emails and this is what we need.

06:21.720 --> 06:24.870
So the view we created is for the email of the employees.

06:24.870 --> 06:31.830
And with this we can actually go ahead and update our employees table to see if anytime we update the

06:31.830 --> 06:33.960
table whether the email will actually be shown.

06:33.960 --> 06:36.630
So from here you can actually populate this email.

06:36.660 --> 06:38.370
You can use this email for marketing.

06:38.370 --> 06:41.520
You can use that just to send them messages anytime.

06:41.550 --> 06:47.130
Always go to your views table and take the email of the employees and message your employees.

06:47.160 --> 06:48.120
I hope that is cool.

06:48.120 --> 06:55.590
So let's go ahead and update our employees table and know if it if we update that the new email address

06:55.620 --> 07:00.330
is going to input there, whether it will show right inside the views table without touching the views

07:00.330 --> 07:00.720
table.

07:00.750 --> 07:01.950
Let's go ahead and check it out.

07:01.950 --> 07:05.340
So go over here and I'm going to say insert.

07:05.370 --> 07:09.960
And I'm going to insert into employees.

07:09.960 --> 07:11.790
So now we're starting to employees.

07:11.790 --> 07:14.100
And we're going to insert the values.

07:14.100 --> 07:22.380
And the values I'm going to insert is going to be start from ID is the workforce ID 1234567.

07:22.410 --> 07:23.910
Inside ID seven.

07:23.910 --> 07:27.660
And, uh, I'm going to insert the name.

07:27.660 --> 07:30.030
Then we're going to set the name is Peter.

07:30.360 --> 07:30.900
All right.

07:30.900 --> 07:33.600
So go ahead and say Peter.

07:33.690 --> 07:38.250
And uh, the next one is the GP.

07:38.310 --> 07:41.640
And he has a GPA of 4.6.

07:41.640 --> 07:45.030
And, uh, the referrer is going to be.

07:45.030 --> 07:45.600
No.

07:45.600 --> 07:54.870
And then the email address which we put is going to be Peter at, let me say given a name, maybe hotmail

07:56.280 --> 07:57.480
hotmail.com.

07:57.480 --> 07:58.530
And that is all.

07:58.530 --> 08:03.180
So why not put semicolon at the end of this and go ahead and refresh this and let's check it out.

08:03.180 --> 08:04.590
So we've corrected that.

08:04.590 --> 08:08.040
Now we first of all go ahead and uh check out.

08:08.610 --> 08:20.840
So go ahead and select uh all flown wireless from the employees on the email.

08:20.870 --> 08:28.250
Go ahead and refresh this and then you can see you have Peter at yahoo.com Yahoo Mail.com.

08:28.400 --> 08:28.940
All right.

08:28.940 --> 08:36.200
So we did not touch the emails employee underscore email taboo which is the view taboo.

08:36.230 --> 08:42.770
But whatever we did in the employee table actually reflected on the employees email because this is

08:42.770 --> 08:44.810
immutable of the employees table.

08:44.840 --> 08:47.450
So if go and select this on that employee.

08:47.480 --> 08:49.190
So then you see Peter right in there.

08:49.220 --> 08:50.510
Go ahead and check this out.

08:50.540 --> 08:51.830
And you can see that Peter is here.

08:51.860 --> 08:58.280
And it's actually reflected on the employees underscore email views.

08:58.280 --> 09:04.610
So I have a nice cool quiet practice with its run and check on docs.

09:04.610 --> 09:07.700
And if you have any questions you go ahead and use the question and answer section.

09:07.700 --> 09:09.980
And I'm going to get back to you as soon as possible.

09:10.010 --> 09:10.880
Thank you so much.

09:10.880 --> 09:13.820
And I'm going to see you in the next video lecture.
