So now that you've seen the three data types we're talking about here around dates, which are date
time and date time.
Let's hop over to Cloud nine and just try them out briefly.
So what I'm going to do is actually make a new table and in this one table, I'm going to use all three
types to three different columns, of course, so that we can compare and contrast how they work.
And you'll see that they're pretty similar, honestly, which is why I didn't want to make three separate
videos, because it would be pretty boring.
It'd be a lot of repetition.
So let's go ahead and do this.
Now we're going to make a table called people,
and in people we will have we're going to work with.
Well, we'll start with name, which will just be a bar chart.
So somebody's name.
Then we're also going to have birthday as a date, birthday as a time and birthday as a date time.
Of course, we can't just call it birthday three times.
So we'll start with birth date.
Is a date.
Then we'll have birth time.
Is it time?
Finally.
Birth date time is kind of annoying.
Let's just do t is a date time.
Just like that.
Okay.
So we have that table now with name, birth date and birth time and birth date.
So we're not going to spend a lot of time adding data in, but let's insert at least two.
So let's do an insert into people and we'll start with name, birth date, birth time, birth date.
Just like that.
And then on a new line, this is going to be the worst part.
So let's make up a date.
Well, a name, first of all, let's say Padma and then the birth date.
Remember, we need that year, year, year, dash month, month, dash de day format.
So we will do 1983 dash.
Let's do 1111.
So that's the birth date, then the birth time needs to follow.
Hours, minute, second.
Well, our our colon.
Minute, minute, colon, second, second.
So let's say
1007.
Whoops.
35.
And then if we want to be accurate for the date time, we would basically combine these two.
So we would have 1983 dash 11, dash 11 space.
At the same time.
Okay.
So that's kind of annoying to type.
You're usually not doing things like this, to be honest, but let's just make sure we don't have any
typos.
We're not missing any quotes.
We'll soon see.
Oh, boy.
We do have a problem.
And this is a silly one.
We're missing the values keyword.
Hopefully you caught that before me.
So I'm just going to recall that and just change some information.
So we have two people in there.
So we had Padma.
Let's put Larry, who was born in 1943
and on December 25th on Christmas.
Pat.
Let's do for.
1042.
And then we'll just copy this so you don't have to retype that whole thing.
I apologize.
It was a little bit painful to sit through.
We're not doing much, but we need some data to work with, so that should be sufficient.
Now, just make sure that matches up.
All right.
So now we do a select star from people.
We have two people in there.
And then we're storing birthday information three different ways, although they're not equivalent,
of course, because we have just the date, just the time and then the date and time together.
So now that we have this data in there, we're going to focus for a couple of videos, pretty short
videos on how we can work with this data.
There are some functions that come with my SQL, which we've seen a bunch of them, but there are some
that work with dates and date times and times, and we're going to focus on those to do things like
format our data nicely.
So how do we format dates?
How do we get the day of the week based when based off of someone's day they were born, things like
that.
How do we print out a nice version?
This is a little bit ugly.
And then also how do we do math with dates?
And we're not going to do any heavy duty math, but things like calculating how many years it's been
from 1943 to now or how many days since Padma was born, those sort of things.
And we'll be able to do that now because we have this data in here.
So thanks for sitting through that.
I know it's probably a bit painful.