Skip to content

Commit 3527dc3

Browse files
committed
Added comments to SQL scripts
1 parent b54158d commit 3527dc3

7 files changed

+30
-5
lines changed

SQL/1. create_cricket_db_staging.sql

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
-- Create staging database
1+
-- ##########################################################
2+
-- Script Name: Cricket Staging Database
3+
-- Author: Chris Rodgers
4+
-- Date: 2024-10-19
5+
-- Purpose: Create staging database
6+
-- ##########################################################
7+
28
-- Create or select the database
39
IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'CricketDBStaging')
410
BEGIN

SQL/2. create_cricket_db.sql

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
-- ##########################################################
2+
-- Script Name: Cricket Star Schema Database
3+
-- Author: Chris Rodgers
4+
-- Date: 2024-10-19
5+
-- Purpose: Create star schema database
6+
-- ##########################################################
7+
18
-- Create or select the database
29
IF NOT EXISTS (SELECT * FROM sys.databases WHERE name = 'CricketDB')
310
BEGIN

SQL/3. tidy_staging.sql

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
-- ##########################################################
2+
-- Script Name: Tidy Staging
3+
-- Author: Chris Rodgers
4+
-- Date: 2024-10-19
5+
-- Purpose: Fix data errors in staging database
6+
-- ##########################################################
7+
18
-- Script to tidy up data in staging before loading to star schema
29

310
UPDATE stg_matches

SQL/4. populate_dim_date.sql

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
-- POPULATE DATE DIMENSION
1+
-- ##########################################################
2+
-- Script Name: Populate DimDate
3+
-- Author: Chris Rodgers
4+
-- Date: 2024-10-19
5+
-- Purpose: Populate the date dimension in the star schema
6+
-- ##########################################################
27

38
-- Declare the date range you want to seed
49
DECLARE @StartDate DATE = '2000-01-01';

SQL/4. populate_star_schema.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- ##########################################################
22
-- Script Name: Cricket Star Schema Load
33
-- Author: Chris Rodgers
4-
-- Date: 2024-09-29
4+
-- Date: 2024-10-19
55
-- Purpose: Load data from staging to the star schema
66
-- ##########################################################
77

SQL/5. check_star_schema_load.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- ##########################################################
22
-- Script Name: Data Quality Checks for Cricket Matches Star Schema
33
-- Author: Chris Rodgers
4-
-- Date: 2024-09-29
4+
-- Date: 2024-10-19
55
-- Purpose: Perform sanity checks after loading data from staging to star schema, this includes checking row count consistency, missing data in star schema, duplicate records, foreign key integrity checks
66
-- ##########################################################
77

SQL/6. information_extraction_queries.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- ##########################################################
22
-- Script Name: Cricket Data Statistics
33
-- Author: Chris Rodgers
4-
-- Date: 2024-09-29
4+
-- Date: 2024-10-19
55
-- Purpose: Variety of SQL queries on Cricket star schema to demonstrate range of SQL skills
66
-- ##########################################################
77

0 commit comments

Comments
 (0)