1 00:00:00,180 --> 00:00:03,660 The next function we'll take a look at is pretty quick as well. 2 00:00:03,690 --> 00:00:05,220 It's called char length. 3 00:00:05,400 --> 00:00:10,080 And what it does is it just tells you how many characters are in a given string, and that's pretty 4 00:00:10,080 --> 00:00:11,100 much all there is to it. 5 00:00:11,100 --> 00:00:14,610 So it looks like this char underscore length. 6 00:00:14,700 --> 00:00:18,240 And when we do it on hello world, we could count the characters. 7 00:00:18,240 --> 00:00:25,590 So one, two, three, four, five, six for the space seven eight, nine, ten, 11 and we get 11 at 8 00:00:25,590 --> 00:00:27,300 least my slide says we get 11. 9 00:00:27,660 --> 00:00:29,070 Let's verify that. 10 00:00:29,280 --> 00:00:30,930 I can't trust those slides. 11 00:00:31,560 --> 00:00:34,260 Whoever made them me. 12 00:00:34,740 --> 00:00:36,660 So you can see we get 11. 13 00:00:37,680 --> 00:00:42,240 So if we changed it and just added a bunch of stuff, we won't count it. 14 00:00:42,240 --> 00:00:44,520 But it says that's 31 characters long. 15 00:00:45,930 --> 00:00:53,750 So we could do something like Select and let's just print out the author last name this time. 16 00:00:53,760 --> 00:00:55,710 So Author L name comma. 17 00:00:55,920 --> 00:01:03,180 Then we'll also side by side print the character, the character length of the author's last name. 18 00:01:03,180 --> 00:01:07,920 So it might say something like Carver. 19 00:01:07,920 --> 00:01:14,640 And then next to that one, two, three, four, five, six characters and Eggers, also six characters 20 00:01:14,640 --> 00:01:15,240 and so on. 21 00:01:15,240 --> 00:01:21,420 So it's just going to be our author's last name, followed by the number of characters in their name. 22 00:01:21,420 --> 00:01:27,180 So character, char length, author, l name just like that. 23 00:01:27,450 --> 00:01:36,210 And let's put an as here and we'll just call it we'll just call it length just like that from books 24 00:01:36,300 --> 00:01:42,870 we'll hit enter and you can see we get this nice little table with our author's last name and the corresponding 25 00:01:42,870 --> 00:01:43,410 length. 26 00:01:43,680 --> 00:01:49,440 So we've got a lot of authors who are six characters long or their last name, six characters long, 27 00:01:49,710 --> 00:01:54,300 and then we get Smith, who's the shortest, and so on. 28 00:01:54,750 --> 00:01:59,040 We'll see later on how we could sort things and order them differently. 29 00:01:59,040 --> 00:02:01,140 But for now, we've got them all here. 30 00:02:01,830 --> 00:02:07,230 All right, so just like before, if you feel like you have a grasp of this, feel free to move on. 31 00:02:07,230 --> 00:02:10,770 I'm just going to show that we can also combine character length. 32 00:02:10,770 --> 00:02:20,940 So what I would like to do is end up with a result that looks something like this Eggers is and then 33 00:02:20,940 --> 00:02:24,870 six characters long. 34 00:02:26,520 --> 00:02:29,790 So I'd like that for every author that we have. 35 00:02:30,300 --> 00:02:38,250 So if we break it down this is going to be author's last name concatenated with is. 36 00:02:39,020 --> 00:02:44,150 Concatenated with the character length, concatenated with characters long. 37 00:02:44,390 --> 00:02:45,830 So it's going to be kind of a big one. 38 00:02:45,830 --> 00:02:47,570 So let's, let's try it out. 39 00:02:47,570 --> 00:02:55,040 We're going to do a select kin cat and the first thing we'll concatenate is the author's last name. 40 00:02:55,040 --> 00:02:56,870 So author LL name. 41 00:02:56,870 --> 00:03:02,120 And then we're going to concatenate that with space is space. 42 00:03:02,120 --> 00:03:03,800 So that gives us this right here. 43 00:03:04,850 --> 00:03:14,080 Then inside of that, we're going to add char length of author l name. 44 00:03:14,090 --> 00:03:17,570 You can see this is getting kind of long comma. 45 00:03:19,300 --> 00:03:26,560 Is excuse me not is space characters long and our parentheses. 46 00:03:27,790 --> 00:03:33,640 So that's kind of a lot here we're concatenating the first thing the author's name and then adding is 47 00:03:33,640 --> 00:03:37,180 and then adding the character length and then adding characters long. 48 00:03:37,210 --> 00:03:43,510 So we're building this sentence one piece at a time, and then we also need to specify from books. 49 00:03:45,010 --> 00:03:46,660 Okay, so let's take a look. 50 00:03:46,660 --> 00:03:51,940 Let's copy this, paste it in, and there we go. 51 00:03:52,150 --> 00:03:54,010 Lahiri is six characters long. 52 00:03:54,520 --> 00:03:57,310 Carver is six characters, Steinbeck is nine characters. 53 00:03:57,310 --> 00:03:59,170 Foster Wallace is 14 characters. 54 00:03:59,650 --> 00:04:01,420 So that's working by now. 55 00:04:01,420 --> 00:04:04,030 You should know we can use as to make this a little prettier. 56 00:04:04,120 --> 00:04:08,770 The only other thing that I'll take a moment to address is that this is kind of ugly. 57 00:04:08,950 --> 00:04:15,850 It's something that I do often to form at my school, meaning my personal school, not my SQL. 58 00:04:15,880 --> 00:04:19,450 The database is used one of these for matters. 59 00:04:19,450 --> 00:04:20,890 So there's a couple of them. 60 00:04:20,890 --> 00:04:23,410 I like this one SQL dash format. 61 00:04:25,670 --> 00:04:33,260 And I can paste in my query and just click format and it will just format it a little nicer for me. 62 00:04:33,500 --> 00:04:36,200 And it depends on when things get really long. 63 00:04:36,200 --> 00:04:39,560 When we have long create tables, it will clean things up nicely for you. 64 00:04:39,560 --> 00:04:41,630 So in this case, this is a cleaned up version. 65 00:04:41,630 --> 00:04:43,460 Not that much of a difference, to be honest. 66 00:04:45,370 --> 00:04:47,020 But we can replace it anyways. 67 00:04:47,530 --> 00:04:48,880 It's a little easier to read. 68 00:04:49,240 --> 00:04:49,840 All right. 69 00:04:49,960 --> 00:04:52,260 So that's all there is to character length. 70 00:04:53,020 --> 00:04:54,760 That's all there is to char length.