All right.
Welcome back.
Me and my cat.
Can you per say hi, ma'am.
That was my cat.
I promised.
So in this video, we're now going to spend some time or you were going to spend some time getting some
practice with the different functions.
We just saw things like Count Min, max and average as well as using them with group.
Bye.
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 don't just do a select star from books and then manually go through 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 I have to say the wording on some of these is it's not great, but I kind of struggle to figure
out how to explain this the best way, basically group things by year that they're released and then
just print out how many were released that year or each year.
So it should look something like 2005 one, 2006 two books, 1945 one book.
Now those numbers I just made up, so don't worry about those numbers.
But basically that's the idea.
You should have the year and then account for how many books were 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.
Oh, 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 release 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 released 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 Max and that issue, my cats being a nightmare.
Hey, come on.
Hello?
No, no.
Oh, my God.
She's just knocking everything off my desk.
Hello?
Okay.
So where was I?
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, the full name.
So you'll need to use that full name.
We 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 that.
If you remember the Minimax video that the second Minimax 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 mean or max.
And then the last challenge here is to print this data out.
So we should have the euros or at least notice that we have an alias for all three of these.
So the year 1945, the number of books released in that year.
So one one, one, one.
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 you need to grip things in this case, but hopefully you can figure that out
based off of this image.
All right.
Got it.
Take care of this cat situation.
Oh, my God.
And then in the next video, we'll have a solution.