A comprehensive collection of SQL scripts for data exploration, analytics, and reporting. These scripts cover various analyses such as database exploration, measures and metrics, time-based trends, cumulative analytics, segmentation, and more.
Purpose — Ready-to-use, well-documented SQL scripts for common analytics tasks.
Structure — Two‑page deliverable (cover poster + content page) and categorized SQL scripts.
Audience — Data analysts, BI engineers, and learners seeking practical SQL examples.
SQL script collection — Organized by analytical theme:
-
Database Exploration — Inspect tables, columns, data types; DISTINCT and profiling queries.
-
Measures & Metrics — SUM, AVG, COUNT, and big-number checks.
-
Time-based Trends — Aggregations by day/month/year, MIN/MAX, DATEDIFF, seasonality checks.
-
Cumulative Analytics — Running totals, moving averages, and window function examples.
-
Segmentation & Reporting — CASE WHEN buckets, Top N reports, part-to-whole calculations.
Poster placeholder — High-quality poster layout integrated into the cover page for easy replacement.
README and LICENSE — This README plus a suggested license for reuse and attribution.
-
Dimensions & Measures — Distinguish categorical vs numeric fields; choose correct aggregations.
-
Trends & Time Analysis — Detect patterns, compute period-over-period metrics, and use date functions.
-
Performance Metrics — Compare current values to targets and historical baselines.
-
Cumulative & Windowing — Implement running totals, moving averages, and windowed comparisons.
-
Segmentation & Proportions — Create buckets, compute part-to-whole percentages, and produce Top N reports.
-
SQL Best Practices — Clear examples of DISTINCT, GROUP BY, CASE WHEN, subqueries, and window functions.
Attribution — Created by Data with Baraa — Baraa Khatib Salkini (YouTube: Data with Baraa). Please retain the credit line on the cover and footer when sharing publicly. 🙏
Suggested license — Consider a permissive license for sharing and reuse (e.g., MIT or CC BY 4.0). Add a LICENSE file to the repository to clarify reuse terms.