Skip to content

KikeSenpai/SQLPractice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Practice Problems for Data Engineers

Overview

This repository contains a collection of SQL practice problems specifically designed for Data Engineers. It offers a diverse range of real-world scenarios to enhance your data manipulation, data modeling, and querying skills using SQL in a Postgres environment.

Most importantly there are tests pre-configured for each practice problem ... via docker and docker-compose ... using Postgres SQL dialect. Testing is as easy as docker-compose up basic for example. to see if your solution passes or fails.

Getting Started

Prerequisites Docker docker-compose The ability to build and Docker image, run a docker-compose command, and kill a running container (Postgres)

NOTE

Ensure you don't have already running instance of Postgres for Docker ... do docker ps and be sure you don't before starting. If you do, kill that container.

Don't forget if you have been running other Postgres images ... or in-between running the intermediate and advanced Postgres images ... you should kill the Postgres running container. Run docker ps and if you see Postgres running ... kill it. docker kill image {image_id}

You want a clean slate inbetween the three different sets of exercises .... so wipe your Postgres image, aka kill it when moving between folders

First, cd into the directory you first want to work on.

- beginner-problems
- intermediate-problems
- advanced-problems

Then you must build the Docker image in the directory you're working on.

docker build . --tag=beginner
docker build . --tag=intermediate
docker build . --tag=advanced

Next read the questions. Place your SQL to the questions in the tests/sqlhereyouhobbit.sql files ... Each problem is labeled.

To check if your SQL is correct, run the unit tests against them by running ... docker-compose up beginner or docker-compose up intermediate etc. Each problems unit test will either pass or fail.

Practice Problems

The practice problems are categorized into different levels - beginner - intermediate - advanced. Each problem comes with a description, expected outcome, and hints (if needed). As well, there are pre-configured tests via docker-compose up test beginner or docker-compose up test intermediate etc.

There are three folders ...

beginner-problems
intermediate-problems
advanced-problems

Each folder contains a README file that lists all the problems to solve. The Postgre instance already contains the DDL and Data to support your queries.

Within each folder there is a file called sqlhereyouhobbit.py There is an emptry string associated with each problem.

problem_1 = """
{put your SQL here}
"""

Once you are done, or at any point want to test your answer to a question ... simply run docker-compose up basic or docker-compose up intermediate or docker-compose up advanced The tests will automatically run and either pass or fail.

Beginner: - Focuses on basic queries, data selection, and filtering. Intermediate: - Covers joins, subqueries, and aggregate functions. Advanced: - Involves complex queries, window functions, and performance tuning.

About

Set of initial exercises to practice SQL skills

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •