Loading lesson...
The five tricks that gate every data engineering loop
The five tricks that gate every data engineering loop
Topics covered: Sessionization, Gaps and Islands, Deduplication via ROW_NUMBER, Recursive CTEs, Conditional Pivot
The Pattern Now take the cumulative sum of that flag: The Query How to Spot It Follow-Ups
The Pattern The Query Gaps vs. Islands Both use the same subtraction trick. Islands group consecutive rows. Gaps find the spaces between them. How to Spot It Follow-Ups
You have a customers table where each customer appears multiple times with different timestamps. Keep exactly one row per customer: the most recent record. The Pattern The Query ROW_NUMBER vs. RANK vs. DENSE_RANK How to Spot It Follow-Ups
The Pattern The Query Other Problems, Same Shape How to Spot It Follow-Ups
You have a tall table of monthly metrics. One row per (product, month) pair. Turn it into a wide table with one column per month. Most SQL engines have no PIVOT keyword. Desired output: The Pattern SUM vs. MAX How to Spot It Follow-Ups