WEBVTT

00:00.090 --> 00:00.450
All right.

00:00.450 --> 00:01.400
Welcome back.

00:01.410 --> 00:05.040
Me and my cat Cooper.

00:05.650 --> 00:06.700
Wow.

00:07.340 --> 00:09.120
That was my cat promised.

00:09.200 --> 00:13.380
So in this video we're now going to spend some time or you're going to spend some time getting some

00:13.380 --> 00:20.310
practice with the different functions we just saw things I count men Max some and average as well as

00:20.310 --> 00:22.100
using them with Group.

00:22.410 --> 00:27.330
So in this video I'm just going to lay out the challenges for the exercises and then in the next video

00:27.420 --> 00:29.400
we'll talk about solutions.

00:29.430 --> 00:37.230
So the first one is to print the number of books in the database so you know don't just do a select

00:37.230 --> 00:44.010
star from books and then manually go through in and tabulate or count them write a single line that

00:44.010 --> 00:50.090
will print out the number of books in the database and then once you've done that move on to this one.

00:50.430 --> 00:56.470
Print out how many books were released in each year and after say the wording on some of these is it's

00:56.580 --> 00:58.340
not great.

00:58.620 --> 01:02.730
But I kind of struggled to figure out how to explain this the best way.

01:02.730 --> 01:10.230
Basically group things by year that they were released and then just print out how many were released

01:10.260 --> 01:11.850
that year each year.

01:12.210 --> 01:20.140
So it should look something like 2005 and 2006 two books 1945 one book.

01:20.220 --> 01:22.100
Now those numbers are just made up.

01:22.260 --> 01:24.470
So don't worry about those numbers.

01:24.480 --> 01:26.470
But basically that's the idea.

01:26.630 --> 01:34.500
You should have a year and then accounting for how many books are released that year and then next up.

01:34.500 --> 01:37.550
Print out the total number of books in stock.

01:37.740 --> 01:42.480
So there's a stock quantity and every book has a stock quantity.

01:42.810 --> 01:45.800
So print out the sum.

01:46.100 --> 01:47.710
Ah I just gave it away.

01:47.910 --> 01:52.800
Well print out the sum of all of the books in stock.

01:52.800 --> 02:01.120
So just add together all the quantities and then find the average released year for each author.

02:01.440 --> 02:09.930
So you'll need to go through group things by author first or last and first name and then find the average

02:09.930 --> 02:12.060
year that they were released for each author.

02:12.210 --> 02:18.420
So your results should look something like Raymond and then Carver and then the third column should

02:18.420 --> 02:20.220
be the average or least year.

02:20.370 --> 02:23.500
Let's say that's 1980 5.2 or something.

02:25.700 --> 02:29.930
Next up find the full name of the author who wrote the longest book.

02:29.930 --> 02:34.710
So full name here is in a different color because it's a little different.

02:34.940 --> 02:41.570
This one you'll need to use one of the tricks that we saw in that video where we talked about men and

02:41.570 --> 02:46.300
Macs and that issue and my cats being a nightmare.

02:46.870 --> 02:48.860
C'mon.

02:49.240 --> 02:50.980
No no.

02:52.670 --> 02:54.860
She's just knocking everything off my desk.

02:56.090 --> 02:59.430
Low OK.

02:59.490 --> 03:07.680
So what was the idea here is to not just find the longest book or the page count for the longest book

03:08.040 --> 03:15.790
but actually print out the name of the author of the full name so you'll need to you can get full name

03:16.110 --> 03:19.780
you want first Plus last name with a space in between.

03:20.190 --> 03:26.610
Of the author who wrote the longest book so you need to find the longest book and then use that to find

03:26.790 --> 03:28.310
the author basically.

03:28.460 --> 03:29.820
And there's a couple of ways of doing it.

03:29.820 --> 03:35.550
If you remember the min and max video that the second min and max video where I talked about some of

03:35.550 --> 03:42.360
the problems or one problem in particular that arises when you try and print information like title

03:42.360 --> 03:50.630
or author based off of something being men or max and then the last challenge here is to print this

03:50.630 --> 03:51.690
data.

03:51.950 --> 03:56.710
So we should have the years released notice that we have an alias for all three of these.

03:56.840 --> 04:04.220
So that year like 1945 the number of books released in that year so you know 1 1 1 1.

04:04.370 --> 04:05.390
But then here we go.

04:05.420 --> 04:11.540
In 2001 there were three books and then the average number of pages for those books released in that

04:11.540 --> 04:13.440
year.

04:13.680 --> 04:18.510
So I won't tell you how any to group things in this case but hopefully you can figure that out based

04:18.510 --> 04:20.340
off of this image.

04:20.340 --> 04:21.500
All right you get it.

04:21.630 --> 04:23.300
Take care of this cat situation.

04:23.310 --> 04:24.340
Oh my God.

04:24.720 --> 04:27.400
And then in the next video we'll have a solution.
