PIVOT and UNPIVOT in SQL Server: Turn Rows into Columns (and Back)
How to turn rows into columns in SQL: conditional aggregation that works everywhere, the SQL Server PIVOT operator, dynamic pivot, and two ways to unpivot (without losing NULLs).
How to turn rows into columns in SQL: conditional aggregation that works everywhere, the SQL Server PIVOT operator, dynamic pivot, and two ways to unpivot (without losing NULLs).
Build an accounts receivable aging report in SQL Server step by step: open amount per invoice, days overdue, aging buckets per customer, totals, and common mistakes.
Calculate averages, medians, percentiles, mode and standard deviation in SQL Server and MySQL, find outliers, and learn which number to report.
25 SQL interview questions that come up again and again for junior roles, with short answers you can say out loud: joins, GROUP BY, NULL, keys, indexes, ACID, and three classic write-a-query tasks.
How to get the latest record or the top N rows for each group in SQL Server with ROW_NUMBER(), handle ties correctly, and when CROSS APPLY or WITH TIES is the better choice.
WHERE filters rows before grouping. HAVING filters groups after GROUP BY. See the difference with a simple sales example, the logical query order, and common mistakes.
A beginner-friendly guide to SQL window functions: OVER, PARTITION BY, ROW_NUMBER, RANK, running totals and LAG, with clear examples.
Once you can read rows from a table, the next question is almost always a summary. How many orders did