I'll call you back again to another video lecture in MySQL.
And in this video lecture, I'll go ahead and teach you how to work with correct date and time.
All right.
So we have a table ready here.
According to this table.
What.
We're not going to touch that table because I want to do something different in this lecture.
Let's go ahead and create our own table I'll go ahead and say create.
And uh let the table name be My Allah.
Okay.
So that is the name of a table.
And we're going to drop this table after we've done this.
And, uh, let me go ahead and see inside here I want to create some columns and I'm going to name the
first one to be my date.
And the data type is going to be date.
Then the next one I'm going to create is, uh, underscore my time and the data type is going to be
time.
Then I'm going to show you the next one, which is called my I'm going to name that one my date time.
Remember that our distance data type so dates time.
So because you have that time.
All right.
So let's say we want us to create and I want to show the table.
Let's go ahead and say select all then from my our.
All right.
So go ahead and create this table.
And uh the table is now created.
So you can see we have a table called my our.
And if I go ahead and refresh this place, you can see I have my, our right in here.
And, uh, it's I have the columns, my date, my time, my date time.
All right.
Now let me go ahead and insert inside here.
The one went inside is the current date, the current time and the current date time.
I want to show the time I'm working right presently the time of making this video.
So let's go ahead and show that.
Go ahead and select everything here and delete it.
Now we go ahead and use what you've learned in previous lectures with is the inserts.
And then go ahead and insert into your table called My Hour.
Remember I have two tables now.
My hour and student's table.
So we're not touching the student's table.
Then go ahead and say the values which are going to add right in here.
And go ahead and press semicolon.
And so I'll go ahead and say the values are going to add is the current.
We're going to add the current underscore dates.
All right.
So current underscore dates.
Then the next one I want to add is a.
Current underscore time.
And then last ones are the score now.
So I also want to add this which means immediately presently which is today.
And I have this selects which is going to pop up and show us what we are working on.
All right.
Now we go ahead and, uh, execute this.
And, uh, over here, you can see I have my dates, 20, 24, zero nine, 24, which is a September.
And this is the time I'm working presently.
And this is a time I'm working presently.
You can see that.
All right.
Now, if I were to show the regular this is for today, which I'm working on, if I want to show you
tomorrow or I want to show maybe yesterday, how can I do to do that in MySQL?
Now, what I'm going to do is let me go ahead and, uh, make this to be no for my dead time, then
go ahead and say this is no.
Then the current time.
Let's make that to be no.
So that, uh, if we go ahead and execute this, we're going to get no, no.
So we can be able to see what it be here.
Now I'll go ahead.
Oh, I've inserted this.
All right.
so let me go ahead and, uh, remove these, because I was still working out inside.
So I saw the first one and I went inside the second one.
Now I'll go ahead and leave that the way it is, because you've already understood what you're doing.
I want to show the yesterday and today.
So if you want to do that, I'll go right in here.
And, uh, I'm going to make this to be plus one.
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.
So if I go ahead and run this, so check the next one, I can see plus one which is a 25.
It shows that we have 20, 24 and 25.
This is tomorrow.
And if you want to show maybe yesterday, what I'm going to do is go ahead and say minus and hit on
this.
And we inserted yesterday which is 2023.
So this is a nice way to play around with date and time in MySQL?
And that is just what I want to show you on this and I hope that is cool.
Now let's go ahead and, uh, drop this table because we are done with it.
I just want to show about date time and then we'll go ahead and move on.
So drop table and the name of the table is, uh, my hour.
And then we go ahead and execute this program.
And over here, if I refresh this you can no longer see any table called my hour.
And that is it for that time.
So on with it.
And I am sure you know how to add plus one minus one.
And now showing the current time you are working yesterday and tomorrow.
And that is where you can able to query that time in MySQL.
I hope that is cool.
So that is it for now.
If you have any questions, please 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.