All right.
Welcome back.
Me and my cat Cooper.
Wow.
That was my cat promised.
So in this video we're now going to spend some time or you're going to spend some time getting some
practice with the different functions we just saw things I count men Max some and average as well as
using them with Group.
So in this video I'm just going to lay out the challenges for the exercises and then in the next video
we'll talk about solutions.
So the first one is to print the number of books in the database so you know don't just do a select
star from books and then manually go through in and tabulate or count them write a single line that
will print out the number of books in the database and then once you've done that move on to this one.
Print out how many books were released in each year and after say the wording on some of these is it's
not great.
But I kind of struggled to figure out how to explain this the best way.
Basically group things by year that they were released and then just print out how many were released
that year each year.
So it should look something like 2005 and 2006 two books 1945 one book.
Now those numbers are just made up.
So don't worry about those numbers.
But basically that's the idea.
You should have a year and then accounting for how many books are released that year and then next up.
Print out the total number of books in stock.
So there's a stock quantity and every book has a stock quantity.
So print out the sum.
Ah I just gave it away.
Well print out the sum of all of the books in stock.
So just add together all the quantities and then find the average released year for each author.
So you'll need to go through group things by author first or last and first name and then find the average
year that they were released for each author.
So your results should look something like Raymond and then Carver and then the third column should
be the average or least year.
Let's say that's 1980 5.2 or something.
Next up find the full name of the author who wrote the longest book.
So full name here is in a different color because it's a little different.
This one you'll need to use one of the tricks that we saw in that video where we talked about men and
Macs and that issue and my cats being a nightmare.
C'mon.
No no.
She's just knocking everything off my desk.
Low OK.
So what was the idea here is to not just find the longest book or the page count for the longest book
but actually print out the name of the author of the full name so you'll need to you can get full name
you want first Plus last name with a space in between.
Of the author who wrote the longest book so you need to find the longest book and then use that to find
the author basically.
And there's a couple of ways of doing it.
If you remember the min and max video that the second min and max video where I talked about some of
the problems or one problem in particular that arises when you try and print information like title
or author based off of something being men or max and then the last challenge here is to print this
data.
So we should have the years released notice that we have an alias for all three of these.
So that year like 1945 the number of books released in that year so you know 1 1 1 1.
But then here we go.
In 2001 there were three books and then the average number of pages for those books released in that
year.
So I won't tell you how any to group things in this case but hopefully you can figure that out based
off of this image.
All right you get it.
Take care of this cat situation.
Oh my God.
And then in the next video we'll have a solution.