
SQL
Latest record per customer in SQL: ROW_NUMBER and ties
I show how to select each customer's complete latest order, resolve ties and place filters so a marketing list answers the question you actually intended.
Tag
KajoData articles about SQL. Practical knowledge about data analysis, tools and careers.
Articles: 8

SQL
I show how to select each customer's complete latest order, resolve ties and place filters so a marketing list answers the question you actually intended.

Career & business
I connect grain, cardinality, cohorts and other analytical concepts to the decisions behind a report, with examples and questions to ask before writing a query.

expert
Zastanawiasz się, jak wygląda codzienność inżyniera danych? W tym wywiadzie z Darkiem Butkiewiczem (NIEINFORMATYK) poznasz kulisy tej pracy, realne technologie i wskazówki dla osób myślących o przebranżowieniu.

SQL
The average customer places a few orders. But how many buy once, and how many return regularly? I build the distribution step by step, including the mistakes that make valid SQL answer the wrong question.

SQL
A pivot can look correct while losing orders. I show how to count categories, distinguish zero from missing data and reconcile the columns with the source.

SQL
A query with three CTEs can look impressive while calculating the wrong sales total. I build one analysis step by step, keeping track of row meaning, missing values and the order of calculations.

SQL
A query can run successfully and answer the wrong question. I work through six orders to show how selection, grouping, missing values and result checks fit together.

Career & business
A query can run successfully and still answer the wrong question. Work through order grain, joins, missing amounts and a reproducible reconciliation.