Advanced SQL Recipes to jump start your Analysis

This is a compendium of Advanced SQL tricks meant to serve as a reference for data analysts. There's no particular order to reading these recipes – each one starts with an applicable business case. Start with the most pressing business decision you are facing, and solve it by using the SQL recipe as a template.

Our goal is to make this the most comprehensive and insightful resource on the internet. We ensure that new recipes continue to be insightful based on the experience working with our agency clients.

You will learn – bucketing, finding outliers, calculating correlations, budgeting & forecasting, return on spend and investment, data smoothing and cleaning applied to freemium, transactional, advertising, two-sided marketplace and subscription based business models.


Here's a list of what we have so far, and we'll be adding to our library over time:

  1. Calculating Running Total
  2. Smoothing Data
  3. Calculations Per Group
  4. Growth Rates
  5. Summarizing Data
  6. Ranking your Best and Worst Customers
  7. Calculating N-tiles (quartiles, deciles and percentiles)
  8. Calculating Z-Score
  9. Predicting the Future
  10. Database compatibility
  11. Data Cleansing (aka "Wrangling")
  12. Business Model Analysis

  13. Comparing Means with Statistical Testing (coming soon!)

  14. Calculating Median (coming soon!)
  15. Calculating Rank (coming soon!)
  16. Calculating n-grams (coming soon!)
  17. String Parsing (coming soon!)
  18. Full text search and text mining (coming soon!)
  19. Calculating Funnel drop-off (coming soon!)
  20. Calculating Marketing Channel Attribution Coefficients (coming soon!)
  21. Cohort charts for Retention Analysis (coming soon!)
  22. JSON document stores (coming soon!)
  23. EXPLAIN ANALYZE (coming soon!)
  24. Pivoting and Unpivoting data (coming soon!)
  25. Intrusion Dection with IP addresses (coming soon!)
  26. Nested data types (coming soon!)
  27. GIS/Spatial queries (coming soon!)
  28. Recursive queries (coming soon!)
  29. Correlated and Uncorrelated subqueries (coming soon!)

Please reach out with your feedback and suggestions!


No fuss, just SQL We are open sourcing everything from the experience working with our agency clients. They spend thousands of dollars to get this level of detailed analysis – which you can now get for free. You'll learn bucketing, finding outliers, calculating correlations, budgeting & forecasting, return on spend and investment, data smoothing and cleaning applied to freemium, transactional, advertising, two-sided marketplace and subscription based business models. We send one update every week. Join 400+ data analysts who are leveling up with our recipes. 👊

No spam, ever! Unsubscribe any time.