All right.
You know the drill.
By now, it is your turn to get some practice using the stuff we learned in this section.
So some group buys, maybe some some average count min, max aggregate function, something like that.
Here we go using the books data sets.
I'd like you to start by printing the total number of books in the database using something we just
learned.
So don't do like a select star and then just look at the bottom where it tells you how many rows, but
actually get a number as a result of the select query.
Then print out how many books were released by each year.
So you'll need to use a group by.
And I'd like to see on the left side the year on the right side the count of how many books were released
that year.
Then print out the total number of books in stock.
So we have the stock quantity for each book.
Just sum that all together.
And then find the average released here for each author.
Now, for each author, I'd like you to be conscious of the author first name and last name because
of the whole Harris situation.
But in general, if this is a much bigger data set, we would definitely have a lot of duplicate last
names.
So you should definitely use the first and last name.
When you are grouping.
Find the average released year.
Next, find the full name of the author who wrote the longest book.
So there's maybe more than one way of doing this, but you might need to use a subquery.
Maybe.
And when I say find the full name, I'd like you to have the first name with a space and then the last
name combined or concatenated into a single piece of text.
And then finally, the last exercise here is to make this happen, what you see on the screen.
So we have each release here.
How many books were released in that year and the average number of pages in those books.
So you'll do another group by write by the year, and then you'll count up and average things and make
sure you have this text show up as well, using an alias or aliases.
Okay.
So please do this.
If you have any inclination towards these exercises, get some practice.
You know, these are it's a very simple data set so it can help.
It's a good place to practice.
Basically.
We know the data set by now.
We know how many books were released in each year, how many books.
Dave Eggers has written three in our data set, unlike working with some really large data set.
And we'll do some of that later where you kind of just have to trust that your answers are right in
this sort of data set.
We know if we're right or wrong, so we get some practice, pause the screen, look at the slides,
do eat past the screen, pause video, look at the slides and do each one of these and I'll be back
with a solution in just a second.