Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Evaluation Order and Common Problems
Window functions and GROUP BY
Summary and Review

Instruction

Great job. So, to sum up this section, remember the following rule: the only places where we can use window functions without subqueries are the SELECT and ORDER BY clauses. In all other places, we must use subqueries.

Exercise

You've seen several examples where the window function was placed in the SELECT clause, but how about trying to put it in the ORDER BY clause?

For each auction, show the following columns: Id, Views, and Quartile (based on the number of views in descending order). Order the rows by quartile.

Stuck? Here's a hint!

In the ORDER BY clause, write the same window function as in the SELECT clause.