Advanced SQL Recipes to jump start your Analysis

This section is a compendium of Advanced SQL tricks you can customize for your analysis. Not all databases support all of these recipes, we've made a note where applicable.

Even if you're a pro with SQL, we've started out each recipe with a couple of real-life examples. Hope to spark your inspiration!


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. Data Cleansing (aka "Wrangling")
  11. Comparing Means with Statistical Testing (coming soon!)
  12. Calculating Median (coming soon!)
  13. Calculating Rank (coming soon!)
  14. Calculating n-grams (coming soon!)
  15. String Parsing (coming soon!)
  16. Full text search and text mining (coming soon!)
  17. Calculating Funnel drop-off (coming soon!)
  18. Calculating Marketing Channel Attribution Coefficients (coming soon!)
  19. Cohort charts for Retention Analysis (coming soon!)
  20. JSON document stores (coming soon!)
  21. EXPLAIN ANALYZE (coming soon!)
  22. Pivoting and Unpivoting data (coming soon!)
  23. Intrusion Dection with IP addresses (coming soon!)
  24. Nested data types (coming soon!)
  25. GIS/Spatial queries (coming soon!)
  26. Recursive queries (coming soon!)
  27. Correlated and Uncorrelated subqueries (coming soon!)

Please reach out with your feedback and suggestions!