WEBVTT

00:07.910 --> 00:11.000
I'll call you back again to another video lecture in MySQL.

00:11.000 --> 00:17.510
And in this video lecture, I'll go ahead and teach you how to work with correct date and time.

00:18.530 --> 00:18.800
All right.

00:18.830 --> 00:20.090
So we have a table ready here.

00:20.090 --> 00:21.290
According to this table.

00:21.290 --> 00:21.650
What.

00:21.650 --> 00:25.700
We're not going to touch that table because I want to do something different in this lecture.

00:25.730 --> 00:29.330
Let's go ahead and create our own table I'll go ahead and say create.

00:29.330 --> 00:33.950
And uh let the table name be My Allah.

00:34.160 --> 00:34.490
Okay.

00:34.490 --> 00:35.960
So that is the name of a table.

00:35.960 --> 00:39.350
And we're going to drop this table after we've done this.

00:39.380 --> 00:45.860
And, uh, let me go ahead and see inside here I want to create some columns and I'm going to name the

00:45.860 --> 00:48.860
first one to be my date.

00:48.860 --> 00:51.800
And the data type is going to be date.

00:51.830 --> 00:59.030
Then the next one I'm going to create is, uh, underscore my time and the data type is going to be

00:59.030 --> 00:59.840
time.

00:59.870 --> 01:05.840
Then I'm going to show you the next one, which is called my I'm going to name that one my date time.

01:05.880 --> 01:11.160
Remember that our distance data type so dates time.

01:11.160 --> 01:13.200
So because you have that time.

01:13.740 --> 01:14.040
All right.

01:14.040 --> 01:17.490
So let's say we want us to create and I want to show the table.

01:17.520 --> 01:26.610
Let's go ahead and say select all then from my our.

01:27.540 --> 01:27.990
All right.

01:27.990 --> 01:30.390
So go ahead and create this table.

01:30.750 --> 01:34.500
And uh the table is now created.

01:34.500 --> 01:39.570
So you can see we have a table called my our.

01:39.570 --> 01:44.100
And if I go ahead and refresh this place, you can see I have my, our right in here.

01:44.100 --> 01:50.010
And, uh, it's I have the columns, my date, my time, my date time.

01:50.400 --> 01:50.940
All right.

01:50.970 --> 01:54.030
Now let me go ahead and insert inside here.

01:54.030 --> 01:59.820
The one went inside is the current date, the current time and the current date time.

01:59.820 --> 02:03.930
I want to show the time I'm working right presently the time of making this video.

02:03.930 --> 02:05.880
So let's go ahead and show that.

02:05.910 --> 02:08.310
Go ahead and select everything here and delete it.

02:08.340 --> 02:13.120
Now we go ahead and use what you've learned in previous lectures with is the inserts.

02:13.360 --> 02:18.850
And then go ahead and insert into your table called My Hour.

02:19.120 --> 02:20.710
Remember I have two tables now.

02:20.740 --> 02:22.870
My hour and student's table.

02:22.870 --> 02:24.580
So we're not touching the student's table.

02:24.610 --> 02:28.840
Then go ahead and say the values which are going to add right in here.

02:29.020 --> 02:31.480
And go ahead and press semicolon.

02:31.480 --> 02:40.060
And so I'll go ahead and say the values are going to add is the current.

02:40.630 --> 02:44.680
We're going to add the current underscore dates.

02:46.480 --> 02:46.810
All right.

02:46.810 --> 02:48.790
So current underscore dates.

02:49.570 --> 02:52.180
Then the next one I want to add is a.

02:55.660 --> 03:00.220
Current underscore time.

03:01.450 --> 03:05.560
And then last ones are the score now.

03:05.560 --> 03:12.550
So I also want to add this which means immediately presently which is today.

03:12.550 --> 03:18.820
And I have this selects which is going to pop up and show us what we are working on.

03:18.820 --> 03:19.510
All right.

03:19.540 --> 03:24.400
Now we go ahead and, uh, execute this.

03:24.970 --> 03:32.890
And, uh, over here, you can see I have my dates, 20, 24, zero nine, 24, which is a September.

03:32.890 --> 03:35.620
And this is the time I'm working presently.

03:35.620 --> 03:38.530
And this is a time I'm working presently.

03:38.530 --> 03:39.460
You can see that.

03:40.360 --> 03:40.630
All right.

03:40.630 --> 03:46.540
Now, if I were to show the regular this is for today, which I'm working on, if I want to show you

03:46.570 --> 03:53.050
tomorrow or I want to show maybe yesterday, how can I do to do that in MySQL?

03:53.140 --> 04:02.260
Now, what I'm going to do is let me go ahead and, uh, make this to be no for my dead time, then

04:02.260 --> 04:04.240
go ahead and say this is no.

04:06.160 --> 04:08.380
Then the current time.

04:08.380 --> 04:10.210
Let's make that to be no.

04:10.210 --> 04:15.100
So that, uh, if we go ahead and execute this, we're going to get no, no.

04:15.100 --> 04:16.990
So we can be able to see what it be here.

04:17.020 --> 04:18.640
Now I'll go ahead.

04:18.670 --> 04:20.320
Oh, I've inserted this.

04:20.350 --> 04:20.770
All right.

04:20.810 --> 04:27.440
so let me go ahead and, uh, remove these, because I was still working out inside.

04:27.440 --> 04:30.590
So I saw the first one and I went inside the second one.

04:30.620 --> 04:34.580
Now I'll go ahead and leave that the way it is, because you've already understood what you're doing.

04:34.610 --> 04:37.460
I want to show the yesterday and today.

04:37.460 --> 04:40.580
So if you want to do that, I'll go right in here.

04:40.580 --> 04:46.460
And, uh, I'm going to make this to be plus one.

04:46.700 --> 04:56.600
So if I say this is a plus one, what it means is that I'm going to make this which is going to be tomorrow.

04:56.600 --> 05:05.150
So if I go ahead and run this, so check the next one, I can see plus one which is a 25.

05:05.480 --> 05:10.430
It shows that we have 20, 24 and 25.

05:10.460 --> 05:12.080
This is tomorrow.

05:12.110 --> 05:19.370
And if you want to show maybe yesterday, what I'm going to do is go ahead and say minus and hit on

05:19.370 --> 05:19.940
this.

05:19.970 --> 05:24.350
And we inserted yesterday which is 2023.

05:24.350 --> 05:28.940
So this is a nice way to play around with date and time in MySQL?

05:28.940 --> 05:33.350
And that is just what I want to show you on this and I hope that is cool.

05:33.380 --> 05:38.120
Now let's go ahead and, uh, drop this table because we are done with it.

05:38.120 --> 05:41.930
I just want to show about date time and then we'll go ahead and move on.

05:41.930 --> 05:46.550
So drop table and the name of the table is, uh, my hour.

05:46.550 --> 05:50.300
And then we go ahead and execute this program.

05:50.300 --> 05:55.130
And over here, if I refresh this you can no longer see any table called my hour.

05:55.130 --> 05:56.870
And that is it for that time.

05:56.870 --> 05:58.040
So on with it.

05:58.040 --> 06:01.160
And I am sure you know how to add plus one minus one.

06:01.160 --> 06:05.510
And now showing the current time you are working yesterday and tomorrow.

06:05.510 --> 06:09.170
And that is where you can able to query that time in MySQL.

06:09.200 --> 06:10.070
I hope that is cool.

06:10.070 --> 06:11.870
So that is it for now.

06:11.870 --> 06:15.860
If you have any questions, please use the question and answer section and I'm going to get back to

06:15.890 --> 06:17.360
you as soon as possible.

06:17.360 --> 06:18.230
Thank you so much.

06:18.230 --> 06:21.140
And I'm going to see you in the next video lecture.
