1 00:00:00,120 --> 00:00:01,859 Next up, a quick little concept. 2 00:00:01,859 --> 00:00:03,610 We're going to talk about aliases. 3 00:00:03,630 --> 00:00:08,820 When we print out or when we select data, we're not always printing it out, but when we're selecting 4 00:00:08,820 --> 00:00:13,560 data, we can rename a column to make it shorter or easier to understand. 5 00:00:13,800 --> 00:00:16,920 So it's not the same as renaming the column forever. 6 00:00:16,920 --> 00:00:19,080 It's just in our output result. 7 00:00:19,590 --> 00:00:24,090 For example, maybe I don't like working with Kat ID, it's kind of a stupid name. 8 00:00:24,090 --> 00:00:25,620 I should just call it ID. 9 00:00:25,740 --> 00:00:32,850 Well, I can simplify my results by renaming or giving an alias to that column using the as keyword. 10 00:00:33,000 --> 00:00:39,900 Again, this is temporary only for this query and my results would look like this ID instead of cat 11 00:00:39,900 --> 00:00:40,470 ID. 12 00:00:40,530 --> 00:00:41,520 So let me show you. 13 00:00:42,540 --> 00:00:49,530 Let's do a select cat ID and name from cats. 14 00:00:49,740 --> 00:00:50,670 There we are. 15 00:00:50,700 --> 00:00:52,200 Cat underscore ID. 16 00:00:52,230 --> 00:00:56,850 You can see it technically is case insensitive because it should be lowercase. 17 00:00:56,970 --> 00:00:58,650 That's the way the column is named. 18 00:00:59,160 --> 00:01:01,800 But my SQL didn't care anyway. 19 00:01:01,830 --> 00:01:03,090 Cat id in name. 20 00:01:03,090 --> 00:01:05,010 I don't like cat ID, it's just too long. 21 00:01:05,010 --> 00:01:07,830 I need to shorten it so I can rename it. 22 00:01:07,830 --> 00:01:14,850 If right after the name of that column I'm selecting, I put as and then some other name we have ID, 23 00:01:14,850 --> 00:01:19,500 but again, if I describe Cat, it's still called Cat ID. 24 00:01:19,530 --> 00:01:23,160 If I select everything, let's just select star from cats. 25 00:01:23,970 --> 00:01:25,950 It's still called Cat ID. 26 00:01:25,980 --> 00:01:27,900 It was just a temporary thing. 27 00:01:27,900 --> 00:01:29,580 So let's do one more example. 28 00:01:29,580 --> 00:01:31,800 Let's do name as. 29 00:01:32,610 --> 00:01:34,170 Kiddie name. 30 00:01:34,440 --> 00:01:35,130 Sure. 31 00:01:35,220 --> 00:01:36,780 From cats. 32 00:01:37,080 --> 00:01:40,470 And our output has the column name, kiddie name. 33 00:01:40,470 --> 00:01:44,820 But of course, the values here are from the original name column. 34 00:01:45,210 --> 00:01:49,110 So this isn't just about renaming a column when you print it out. 35 00:01:49,680 --> 00:01:54,870 When we get into fancier things like joining data together or writing fancy select queries that are 36 00:01:54,870 --> 00:01:59,570 really complicated, we might have some resulting data that doesn't really have a name. 37 00:01:59,580 --> 00:02:02,720 We use the as keyword to give it a meaningful name. 38 00:02:02,730 --> 00:02:07,200 But for now, the way I've introduced it is in a pretty limited use case. 39 00:02:07,200 --> 00:02:12,570 We would rename a column to make it shorter or easier to understand, but it doesn't help us that much 40 00:02:12,570 --> 00:02:12,990 yet.