1 00:00:00,120 --> 00:00:05,430 So now that you've seen the three data types we're talking about here around dates, which are date 2 00:00:05,640 --> 00:00:07,260 time and date time. 3 00:00:07,290 --> 00:00:11,160 Let's hop over to Cloud nine and just try them out briefly. 4 00:00:12,000 --> 00:00:18,240 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 5 00:00:18,240 --> 00:00:24,600 types to three different columns, of course, so that we can compare and contrast how they work. 6 00:00:24,600 --> 00:00:30,600 And you'll see that they're pretty similar, honestly, which is why I didn't want to make three separate 7 00:00:30,600 --> 00:00:33,570 videos, because it would be pretty boring. 8 00:00:33,600 --> 00:00:34,980 It'd be a lot of repetition. 9 00:00:35,790 --> 00:00:37,860 So let's go ahead and do this. 10 00:00:37,860 --> 00:00:39,780 Now we're going to make a table called people, 11 00:00:42,390 --> 00:00:47,480 and in people we will have we're going to work with. 12 00:00:47,700 --> 00:00:50,640 Well, we'll start with name, which will just be a bar chart. 13 00:00:50,730 --> 00:00:51,990 So somebody's name. 14 00:00:52,820 --> 00:01:00,750 Then we're also going to have birthday as a date, birthday as a time and birthday as a date time. 15 00:01:00,770 --> 00:01:03,590 Of course, we can't just call it birthday three times. 16 00:01:03,800 --> 00:01:06,260 So we'll start with birth date. 17 00:01:07,010 --> 00:01:07,880 Is a date. 18 00:01:09,680 --> 00:01:12,380 Then we'll have birth time. 19 00:01:13,850 --> 00:01:14,930 Is it time? 20 00:01:16,370 --> 00:01:17,300 Finally. 21 00:01:18,320 --> 00:01:21,980 Birth date time is kind of annoying. 22 00:01:22,250 --> 00:01:25,890 Let's just do t is a date time. 23 00:01:25,910 --> 00:01:26,900 Just like that. 24 00:01:29,280 --> 00:01:29,620 Okay. 25 00:01:29,700 --> 00:01:35,490 So we have that table now with name, birth date and birth time and birth date. 26 00:01:36,390 --> 00:01:41,970 So we're not going to spend a lot of time adding data in, but let's insert at least two. 27 00:01:42,000 --> 00:01:55,050 So let's do an insert into people and we'll start with name, birth date, birth time, birth date. 28 00:01:56,250 --> 00:01:57,490 Just like that. 29 00:01:57,510 --> 00:02:03,420 And then on a new line, this is going to be the worst part. 30 00:02:03,420 --> 00:02:05,090 So let's make up a date. 31 00:02:05,100 --> 00:02:14,250 Well, a name, first of all, let's say Padma and then the birth date. 32 00:02:14,460 --> 00:02:19,610 Remember, we need that year, year, year, dash month, month, dash de day format. 33 00:02:19,620 --> 00:02:25,830 So we will do 1983 dash. 34 00:02:25,860 --> 00:02:28,110 Let's do 1111. 35 00:02:29,840 --> 00:02:34,520 So that's the birth date, then the birth time needs to follow. 36 00:02:35,060 --> 00:02:36,800 Hours, minute, second. 37 00:02:36,800 --> 00:02:38,150 Well, our our colon. 38 00:02:38,150 --> 00:02:39,980 Minute, minute, colon, second, second. 39 00:02:40,130 --> 00:02:41,720 So let's say 40 00:02:42,710 --> 00:02:46,180 1007. 41 00:02:46,190 --> 00:02:46,790 Whoops. 42 00:02:49,790 --> 00:02:50,960 35. 43 00:02:52,660 --> 00:02:57,970 And then if we want to be accurate for the date time, we would basically combine these two. 44 00:02:58,090 --> 00:03:03,790 So we would have 1983 dash 11, dash 11 space. 45 00:03:04,790 --> 00:03:06,050 At the same time. 46 00:03:07,200 --> 00:03:07,810 Okay. 47 00:03:08,190 --> 00:03:10,470 So that's kind of annoying to type. 48 00:03:10,830 --> 00:03:15,900 You're usually not doing things like this, to be honest, but let's just make sure we don't have any 49 00:03:15,900 --> 00:03:16,800 typos. 50 00:03:17,340 --> 00:03:18,690 We're not missing any quotes. 51 00:03:19,940 --> 00:03:20,930 We'll soon see. 52 00:03:22,530 --> 00:03:23,160 Oh, boy. 53 00:03:23,340 --> 00:03:24,420 We do have a problem. 54 00:03:24,600 --> 00:03:25,880 And this is a silly one. 55 00:03:25,890 --> 00:03:27,960 We're missing the values keyword. 56 00:03:28,920 --> 00:03:30,780 Hopefully you caught that before me. 57 00:03:34,210 --> 00:03:37,930 So I'm just going to recall that and just change some information. 58 00:03:37,930 --> 00:03:39,490 So we have two people in there. 59 00:03:39,490 --> 00:03:40,730 So we had Padma. 60 00:03:40,750 --> 00:03:50,680 Let's put Larry, who was born in 1943 61 00:03:52,030 --> 00:03:58,540 and on December 25th on Christmas. 62 00:04:01,260 --> 00:04:02,130 Pat. 63 00:04:04,290 --> 00:04:08,280 Let's do for. 64 00:04:11,520 --> 00:04:14,730 1042. 65 00:04:15,780 --> 00:04:19,620 And then we'll just copy this so you don't have to retype that whole thing. 66 00:04:21,630 --> 00:04:22,740 I apologize. 67 00:04:22,830 --> 00:04:25,140 It was a little bit painful to sit through. 68 00:04:25,170 --> 00:04:32,310 We're not doing much, but we need some data to work with, so that should be sufficient. 69 00:04:32,340 --> 00:04:34,800 Now, just make sure that matches up. 70 00:04:36,330 --> 00:04:36,930 All right. 71 00:04:37,410 --> 00:04:40,830 So now we do a select star from people. 72 00:04:41,340 --> 00:04:42,570 We have two people in there. 73 00:04:42,570 --> 00:04:48,420 And then we're storing birthday information three different ways, although they're not equivalent, 74 00:04:48,420 --> 00:04:54,000 of course, because we have just the date, just the time and then the date and time together. 75 00:04:54,120 --> 00:04:58,980 So now that we have this data in there, we're going to focus for a couple of videos, pretty short 76 00:04:58,980 --> 00:05:01,310 videos on how we can work with this data. 77 00:05:01,320 --> 00:05:07,050 There are some functions that come with my SQL, which we've seen a bunch of them, but there are some 78 00:05:07,050 --> 00:05:11,700 that work with dates and date times and times, and we're going to focus on those to do things like 79 00:05:11,700 --> 00:05:13,230 format our data nicely. 80 00:05:13,230 --> 00:05:14,700 So how do we format dates? 81 00:05:14,700 --> 00:05:21,270 How do we get the day of the week based when based off of someone's day they were born, things like 82 00:05:21,270 --> 00:05:21,560 that. 83 00:05:21,570 --> 00:05:24,060 How do we print out a nice version? 84 00:05:24,150 --> 00:05:25,980 This is a little bit ugly. 85 00:05:26,760 --> 00:05:28,860 And then also how do we do math with dates? 86 00:05:28,860 --> 00:05:36,180 And we're not going to do any heavy duty math, but things like calculating how many years it's been 87 00:05:36,180 --> 00:05:42,090 from 1943 to now or how many days since Padma was born, those sort of things. 88 00:05:42,090 --> 00:05:45,270 And we'll be able to do that now because we have this data in here. 89 00:05:45,390 --> 00:05:47,340 So thanks for sitting through that. 90 00:05:47,340 --> 00:05:48,930 I know it's probably a bit painful.