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. This repository contains SQL queries designed to help data analysts and BI professionals quickly explore, segment, and analyze data within a relational database. Each script focuses on a specific analytical theme and demonstrates best practices for SQL queries.
New here? Open the setup guide in the 00_setup folder. It walks you through installing SQL Server and creating the databases, on Windows and Mac, with the fixes for the common errors.
sql-data-analytics-project/
├── 00_setup/ the setup guide, and the one-click Docker setup for Mac
├── datasets/
│ ├── DataWarehouseAnalytics.bak the database, ready to restore
│ └── csv-files/ the same data as CSV, layer by layer: bronze, silver, gold
├── docs/ the project roadmap and the notes
└── scripts/ 00 creates the database, 01 to 06 explore, 07 to 13 analyze and report
Get the database in one of two ways. Restore datasets/DataWarehouseAnalytics.bak in SSMS, which needs SQL Server 2022 or newer. Or run scripts/00_init_database.sql, which creates the database and loads the gold tables from C:\sql\sql-data-analytics-project\datasets\csv-files\. Put the files there, or change the three paths in the script.
Watch on YouTube, or take the guided version with a certificate on my Academy or Udemy.
| Course | YouTube | My Academy | Udemy |
|---|---|---|---|
| SQL | Full course · Playlist | Full Package · Handbook | SQL Bootcamp · SQL for Analytics |
| Python | Full course · Playlist | Full Package · Handbook | Python Bootcamp |
| Tableau | Full course · Playlist | Full Package | Tableau Course · Chart Masterclass |
| Power BI | Full course | ||
| Databricks | Full course |
Materials on my website: SQL · Python · Tableau · Power BI
| Project | YouTube | Materials | Udemy |
|---|---|---|---|
| Data Warehouse | Watch | Repository | Building a Modern Data Warehouse |
| Exploratory Data Analysis | Watch | this repository | SQL for Exploratory Data Analysis |
| Advanced Data Analytics | Watch | this repository |
More on YouTube: Data projects · Data careers
MIT. Use it, change it, share it, with attribution.
Hi, I'm Baraa Khatib Salkini. I spent 17 years in enterprise data engineering and built one of the largest lakehouses at Mercedes-Benz. Today I teach data full-time at Data With Baraa: visually, step by step, from zero to hero.