WEBVTT

00:00.330 --> 00:03.590
The next function we'll take a look at is pretty quick as well.

00:03.780 --> 00:09.030
It's called Chaar length and what it does is it just tells you how many characters are in a given string

00:09.540 --> 00:11.240
and that's pretty much all there is to it.

00:11.250 --> 00:14.750
So it looks like this char underscore length.

00:14.940 --> 00:22.770
And when we do it on hello world we could count the characters so 1 2 3 4 5 6 for the spaced 7 8 9 10

00:22.830 --> 00:25.280
11 and we get 11.

00:25.440 --> 00:27.430
At least my slides says we get 11.

00:27.720 --> 00:29.300
Let's verify that.

00:29.310 --> 00:31.160
Can't trust those slides.

00:31.710 --> 00:33.490
Whoever made them.

00:33.720 --> 00:34.490
Me.

00:34.800 --> 00:36.830
So you can see we get 11.

00:37.680 --> 00:44.040
So if we changed it and just added a bunch of stuff we won't count it but it says that's 31 characters

00:44.040 --> 00:44.810
long.

00:45.380 --> 00:45.880
OK.

00:46.050 --> 00:53.860
So we could do something like select and let's just print out the author last name this time.

00:53.980 --> 00:57.690
So author Al name comma then will also side by side.

00:57.700 --> 01:03.300
Print the chart the character the character length of the author's last name.

01:03.300 --> 01:12.510
So it might say something like Carver and then next to that one two three four five six characters and

01:12.540 --> 01:15.240
eggers also six characters and so on.

01:15.360 --> 01:21.410
So it's just going to be our author's last name followed by the number of characters and their names

01:21.410 --> 01:27.460
so character char length author L name just like that.

01:27.630 --> 01:33.630
And let's put in as here and we'll just call it we'll just call it length.

01:34.020 --> 01:41.490
Just like that from books will enter and you can see we have this nice little table with our author's

01:41.490 --> 01:43.760
last name and a corresponding length.

01:43.830 --> 01:47.630
So we've got a lot of authors who are six characters long.

01:47.640 --> 01:49.420
The last name six characters long.

01:49.860 --> 01:54.870
And then you know we get Smith who's the shortest and so on.

01:54.870 --> 01:59.040
We'll see later on how he could sort things and order them differently.

01:59.070 --> 02:01.840
But for now we've got them all here.

02:01.890 --> 02:02.610
All right.

02:03.480 --> 02:06.060
So just like before if you feel like you have a grasp of this.

02:06.150 --> 02:07.300
Feel free to move on.

02:07.320 --> 02:10.920
I'm just going to show that we can also combine character length.

02:10.950 --> 02:17.160
So what I would like to do is end up with a result that looks something like this.

02:17.640 --> 02:19.790
Eggers is.

02:20.100 --> 02:25.490
And then six characters long.

02:26.610 --> 02:30.420
So I'd like that for every author that we have.

02:30.420 --> 02:40.080
So if we break it down this is going to be author's last name concatenated with is concatenated with

02:40.370 --> 02:44.170
the character length concatenated with characters long.

02:44.550 --> 02:45.920
So it's going to be kind of a big one.

02:45.990 --> 02:47.570
So let's let's try it out.

02:47.640 --> 02:55.000
We're going to do a select concat and the first thing will concatenate is the author's last name.

02:55.110 --> 03:02.160
So author L name and then we're going to concatenate that with space is space.

03:02.220 --> 03:04.140
So that gives us this right here.

03:04.980 --> 03:14.100
Then inside of that we're going to add char length of author L name.

03:14.100 --> 03:16.610
You can see this is getting kind of long.

03:16.800 --> 03:27.620
Comma is excuse me not is space characters long and are parentheses.

03:27.900 --> 03:29.620
So that's kind of a lot here.

03:29.700 --> 03:35.250
We're concatenating the first thing the author's name and then adding is and then adding the character

03:35.250 --> 03:37.160
length and then adding characters long.

03:37.200 --> 03:44.670
So we're building this sentence one piece at a time and then we also need to specify from books.

03:45.030 --> 03:48.290
OK so let's take a look let's copy this.

03:48.770 --> 03:50.380
Paste it in.

03:50.930 --> 03:52.330
And there we go.

03:52.340 --> 03:54.410
Here he is six characters long.

03:54.410 --> 03:55.870
Carver is six characters.

03:55.880 --> 03:57.380
Steinbeck is nine characters.

03:57.380 --> 04:00.890
Foster Wallace is 14 characters so that's working.

04:00.890 --> 04:04.240
By now you should know he can use as to make this a little prettier.

04:04.250 --> 04:08.950
The only other thing that I'll take a moment to address is that this is kind of ugly.

04:08.990 --> 04:16.490
It's something that I do often to form my sequel meaning my personal sequel not my as well the database

04:17.270 --> 04:19.330
is used one of these formatters.

04:19.610 --> 04:20.860
So there's a couple of them.

04:20.940 --> 04:30.950
I like this one as well dash format dot com and I can paste in my query and just click Format and it

04:30.950 --> 04:33.530
will just format it a little nicer for me.

04:33.530 --> 04:38.600
And it depends on you know when things get really long and have long create tables that will clean things

04:38.600 --> 04:39.520
up nicely for you.

04:39.620 --> 04:43.660
So in this case this is a cleaned up version not that much of a difference to be honest.

04:45.380 --> 04:47.220
But we can replace it anyways.

04:47.490 --> 04:49.270
It's a little easier to read.

04:49.280 --> 04:49.920
All right.

04:50.120 --> 04:52.460
So that's all there is to character like.

04:53.060 --> 04:54.460
That's all there is to char like.
