This project demonstrates SQL proficiency using real-world analytics scenarios in a fictitious online learning platform.
- Apply Set Theory (UNION, INTERSECT, EXCEPT)
- Use Semi and Anti Joins
- Implement Subqueries in SELECT, WHERE and FROM
learning platform-sql-project/
│
├── images/
│ ├── erd.png
│ ├── q1_UNION_ALL_result.png
│ ├── q1_UNION_result.png
│ ├── q2_result.png
│ ├── q3_result.png
│ ├── q4_result.png
│ ├── q5_result.png
│ ├── q6_result.png
│ ├── q7_result.png
│ └── q8_result.png
│
├── sql/
│ ├── 01_table_creation_and_data_insertion.sql
│ ├── 02_set_operations.sql
│ ├── 03_semi_and_anti_joins.sql
│ └── 04_subqueries.sql
│
└── README.md
- Get a combined list of students who:
- enrolled in a
Data Sciencecourse - OR subscribed to
Premium
- enrolled in a
- Find students who:
- enrolled in
Programmingcourses - AND have
Premiumsubscription
- enrolled in
- Find students who:
- enrolled in at least one course
- BUT never completed any course
- Get instructors who have at least one completed course enrollment.
- Find courses that no student has completed.
- Show each student with total number of courses enrolled.
- Find students who enrolled in more courses than the average enrollment count.
- Find the
top 3most enrolled courses.
-
02_set_operations.sql - Demonstrates the use of SQL set operations (
UNION,UNION ALL,INTERSECT,EXCEPT) to combine and compare student and course datasets, enabling insights through set-based logic. -
03_semi_and_anti_joins.sql - Implements semi-join and anti-join logic using subqueries to identify matching and non-matching records across related tables, such as completed course activity and inactive courses.
-
05_subqueries.sql - Showcases the use of subqueries across
SELECT,WHERE, andFROMclauses for advanced data analysis, including aggregations, filtering, and derived datasets.
Note: For the case of 01_table_creation_and_data_insertion.sql, the code was generated using AI (ChatGPT) for the purpose of creating the database and insertion of its data to be used for demo purposes.
PostgreSQLandpgAdmin- for database interactionPostgresSQL (psql) CLIandGit BashTerminal - for establishing database connection and displaying query resultsGitandGitHub- for project's version control.
- Difference between
UNIONandUNION ALL - Use of
INTERSECTandEXCEPTin joining tables - Subquery patterns used in analytics









