Courses
SQL Intermediate: Queries That Survive Real Data
Check Yourself: Windows and Dates
Five scenario questions on ranking ties, running totals, date_trunc and time zones. If you miss more than one, reread the lessons in this section.
Course content
Join this Course
Sign in to save your progress.
-
Joins Beyond the Basics
-
Three-Table Joins Without Double Counting
-
Subqueries, EXISTS and IN: Which One When
-
-
-
Thinking in Sets
-
CTEs: Break a Long Query Into Named Steps
-
UNION, INTERSECT and EXCEPT
-
-
-
Windows and Dates
-
Window Functions: ROW_NUMBER, RANK and Running Totals
-
Dates, Times and Time Zones in PostgreSQL
-
-
-
Schema Design That Holds
-
Normalization: Where to Split and Where to Stop
-
UNIQUE, CHECK and Foreign Key Actions
-
-
-
Indexes and Transactions
-
Indexes and EXPLAIN: Why That Query Is Slow
-
Transactions and What Two Users Can See
-
-
- Final Check: SQL Intermediate
1.
Two customers tie for first place with 3 orders each, and the next customer has 2 orders. What do RANK and DENSE_RANK give the next customer?
2.
You use ROW_NUMBER to keep the first order of each customer, but two orders have the same date and the ORDER BY uses only the date. What is the risk?
3.
A running total uses SUM(amount) OVER (ORDER BY day). Two rows share the same day, and both show the same running total. Why?
4.
You write WHERE row_number() OVER (ORDER BY total) = 1 and PostgreSQL says window functions are not allowed in WHERE. What is the fix?
5.
The same daily report for a timestamptz column shows different counts when run from Manila and from New York. What is the real fix?
About
Five scenario questions on ranking ties, running totals, date_trunc and time zones. If you miss more than one, reread the lessons in this section.
- Duration
- 5 min
- Last update
- 10/04/2026
Was this helpful?
0
0
Comments (0)
Sign in to commentNo comments yet.