Blog

SQL Arena Blog

SQL tutorials — plain-English explanations, varied real-life examples, and before/after tables.

Basics: SELECT and filtering

4 articles

Joining tables (JOIN)

3 articles

Aggregation and grouping

2 articles

Subqueries and DISTINCT

4 articles

Window functions

5 articles

What is ROW_NUMBER in SQL? Row numbering for beginners

ROW_NUMBER assigns "a sequential number to each row". Plain words: the first window function worth learning. Descending numbering, numbering within groups via PARTITION BY, the classic top-N per group pattern, and dedup. With tables and common pitfalls.

May 8, 2026SQLROW_NUMBERwindowtutorial

What are RANK and DENSE_RANK in SQL? Ranking with ties for beginners

RANK and DENSE_RANK are ranking functions where equal values get equal ranks. Plain words: the difference between ROW_NUMBER (always unique), RANK (ties get equal rank with gaps after), and DENSE_RANK (equal rank without gaps). With tables, an Olympic-style example, and common pitfalls.

May 8, 2026SQLRANKDENSE_RANKwindow

What is PARTITION BY in SQL? Groups inside a window for beginners

PARTITION BY is the part of OVER that splits rows into groups for window functions. Plain words: like GROUP BY, but rows don't collapse — each row stays, with its group's aggregate appended. The difference from GROUP BY, typical patterns, and aggregate behavior inside windows.

May 8, 2026SQLPARTITION BYwindowtutorial

What are LAG and LEAD in SQL? Neighbouring rows in a window for beginners

LAG and LEAD return the value from the **previous** or **next** row of a window. Plain words: day-over-day delta, time-to-next-event, price change — tasks that previously required self-joining a table. With tables and common pitfalls.

May 8, 2026SQLLAGLEADwindow

Window functions in SQL: ROW_NUMBER, RANK, LAG/LEAD in practice

Window functions are the analyst's most-used tool in SQL. We'll break down ROW_NUMBER, RANK, LAG/LEAD and PARTITION BY through real cases: top-N per group, day-over-day metrics, cumulative sums.

May 3, 2026SQLwindow-functionstutorialanalytics

CTEs (WITH)

1 article

Data changes (DML)

3 articles

Schema (DDL)

2 articles

Strings and dates

3 articles

CASE and NULL

3 articles

Other

2 articles