Introduction
Simple OVER()
PARTITION BY
Ranking functions
17. Ranking functions – Exercise 3
Window frame
Analytic functions
ORDER BY PARTITION BY
Order of evaluation
Summary

Instruction

Fine! The last but one exercise from ranking functions.

Exercise

Show the first and last name of the customer who bought the second most recent giftcard along with the date when the payment took place. Assume that an individual rank is assigned for each giftcard purchase.

Stuck? Here's a hint!

Use a CTE: WITH ranking AS (...) SELECT ... And pick the row with rank = 2;

Console

Code editor

Result

TableConsole