Okay.
So next up, we're going to continue on with two new functions.
And they go together.
They fit well there, min and max, minimum and maximum.
And they do what they sound like, what their name says.
They help you find and identify minimum values in a table or maximum values in a table, and we can
use them on their own and we can also combine them with group by to get further insights.
So we're going to see how to do both.
We're going to start off by using Min and Max without group by.
So we can do things like find the minimum release here in our entire table.
So what was the first year any book was released?
And to do that just looks like this select min release here in parentheses from books.
So just like we did with Count, where you could just count all the books if you wanted to, you can
just use Min on its own.
So let me show you how to do that.
Now, go over to cloud nine and we can just do a select min released here from.
Books.
And 1945 is the earliest book that we have released.
The earliest years that a book was released, we could also do something like select min pages if we
want to see what's the shortest number of pages.
And that's that tells us 176 is the shortest.
So of course, maximum works the same way.
So instead of min, we just type Max, Max and it does the same thing.
So here we're finding, well, it doesn't do the same thing.
It works in the same way, but it does the exact opposite.
It's going to tell us or return the longest or the highest number of pages.
So if we do that.
Just recall that last line and just change it to be Max.
634.
That is our longest book and we can do the same thing with yea if we wanted to.
2017 is our most recent year.
It's the highest number of year.
So that's the very basics of maximum in or minute max.
However you want to say it.
I do want to call your attention to something sort of weird.
What if I wanted to get the title of the longest book?
Not just the number of pages like we have here.
Just finding out that 634 is the longest.
Isn't that useful?
What if I wanted to know?
What is the book?
What's the title?
Who wrote it?
The year is released.
Any other information?
Well, you might think you could do this.
Select max pages, comma title from books.
And if we try it out, select max pages.
Comma title from books.
It says that The Namesake is our longest book and it has 634 pages.
And while, yes, 634 is the maximum pages in our entire database, the namesake is not 634 pages.
And in fact, if we just do a select and let's just do title pages from books.
If we find the namesake, you'll see that it's 291 pages.
And the one that has 634 is The Amazing Adventures of Kavalier and Clay.
So that's a problem.
Here's a nice little graphic I made.
It's the largest emoji that I could make on these slides for some reason.
So I'm just going to go ahead and insert a much larger one now.
Post production.
Very fancy.
So how how do we get around this?
There has to be a way.
And in fact, there's multiple ways.
In the next video, it's a bit of a cliffhanger here, but the next video, we're going to see a couple
of options, including a preview of a more advanced method, something that we haven't seen just yet.
But there is a way to do it using what we already know.
Something we learned a couple of videos ago.
All right.
Next video.