How to Pivot Data in SQL: PIVOT vs CASE WHEN
Turn rows into columns in SQL with CASE WHEN or PIVOT. Copy-paste examples for PostgreSQL, SQL Server, Snowflake and DuckDB, plus how to unpivot.
Practical SQL for analysts — the patterns you actually reuse, from joins and window functions to running analytics locally with DuckDB.
Turn rows into columns in SQL with CASE WHEN or PIVOT. Copy-paste examples for PostgreSQL, SQL Server, Snowflake and DuckDB, plus how to unpivot.
The recurring SQL interview patterns behind most data analyst interviews, how to approach each, and how interviewers actually grade the answers.
General chat assistants vs BI copilots vs dedicated text-to-SQL products. What each does well, where each breaks, and how to evaluate one.
Learn to read EXPLAIN output, spot the difference between a scan and an index, and fix the handful of causes behind most slow SQL queries.
WHERE filters rows, GROUP BY collapses them into groups, HAVING filters the groups. See SQL's real execution order and where each clause belongs.
What INNER, LEFT, RIGHT and FULL joins actually do, why rows duplicate or disappear, and how to pick the right one for a report.
How to get reliable SQL from ChatGPT, Claude or Copilot. What context to give, how to use examples, and the checks that catch wrong joins and made-up columns.
CTE, subquery or temp table? A plain-English comparison for analysts, with examples, the performance trade-offs, and a simple rule for choosing.
Handle dates in SQL without wrong totals. DATE_TRUNC, week starts, fiscal years and time zones explained for analysts, with queries and a calendar table.
Find duplicate rows in SQL with GROUP BY and ROW_NUMBER, then remove them safely. Copy-paste queries, the traps to avoid, and how to stop duplicates coming back.
Build a cohort retention table in SQL in three steps. Includes a full PostgreSQL query, how to read the triangle, and the mistakes that skew retention.
A practical SQL cheat sheet for data analysts. Fifteen copy-paste queries for filtering, joins, aggregates, CTEs, windows and dates, with plain-English notes.
Query CSV, Parquet and Excel files with plain SQL on your own machine using DuckDB. Practical examples, plus honest limits on concurrency and shared use.
Window functions keep your rows while you calculate across them. Learn ten patterns: ranking, deduplication, running totals, LAG, cohorts and streaks.