skip to today's puzzle
SQL Sip

A window function adds a value to each row

GROUP BY collapses rows into one line per group. A window function works out a value too, but leaves every row where it is and adds the answer as an extra column. The OVER clause is what makes it a window function, and the ORDER BY inside OVER decides the order the rows are read in.

A tiny example

In plain English: Show me every student's name with their place in the score ranking.

SELECT name, RANK() OVER (ORDER BY score DESC) AS place
FROM students;

What comes back

nameplace
Nia1
Theo2
Ravi3

Every student kept their own row, and the extra column shows each one's place by score.

Related SQL lessons

Ready for a break?

Take on today's cozy puzzle. A fresh, bite-sized query waits every morning — no timers, no pressure.

play today's sip