Skip to content

Welcome to my SQL solutions of 8 real-world case studies for #8WeekSQLChallenge!

Notifications You must be signed in to change notification settings

thanakorntha/sql-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

8 Week SQL Challenge

This repository contains all of my case study solutions through SQL queries for #8WeekSQLChallenge by Danny Ma.

Danny's Case Studies

There are eight interesting fictional case studies in this challenge.

No Image Case Study Name Medium GitHub Status
1 Danny's Diner Danny's Diner Link Link 🟢
Completed
(04/05/2023)
2 Pizza Runner Pizza Runner - - ⚪️
To Do
3 Foodie-Fi Foodie-Fi - - 🟢
Completed
4 Data Bank Data Bank - - ⚪️
To Do
5 Data Mart Data Mart - - ⚪️
To Do
6 Clique Bait Clique Bait - - ⚪️
To Do
7 Balanced Tree Clothing Co. Balanced Tree Clothing Co. - - ⚪️
To Do
8 Fresh Segments Fresh Segments - - ⚪️
To Do

Danny's Database Setup

My project utilizes PostgreSQL and pgAdmin to manage Danny's database via Docker Compose. This allows for a consistent and portable database environment across different machines. All eight Danny's databases will be stored as .SQL files in the initdb folder. After deploying this setup, you can access pgAdmin to manage and view Danny's database at http://localhost:8080.

Prerequisites

  1. Git installed (https://git-scm.com/)
  2. Docker installed (https://www.docker.com/)

Running the Containers via Docker Compose

  1. Clone this repository to your local machine.
  2. Navigate to the project directory.
  3. Create and configure the following values in the .env file.
    • POSTGRES_USER=<your_postgres_username>
    • POSTGRES_PASSWORD=<your_postgres_password>
    • PGADMIN_EMAIL=<your_pgadmin_email>
    • PGADMIN_PASSWORD=<your_pgadmin_password>
  4. Run docker compose up -d in your terminal to start the PostgreSQL container and pgAdmin in detached mode.

Access pgAdmin

By default, pgAdmin is accessible through a web interface at http://localhost:8080/. Credentials for accessing the database will be defined in the .env file. After logging in, you can add your database to pgAdmin.

  1. Right-click "Servers" in the top-left corner and select "Create" -> "Server..."
  2. Name your connection
  3. Change to the "Connection" tab and add the connection details:
    • Hostname: "postgres"
    • Port: "5432"
    • Maintenance Database: danny_db
    • Username: $POSTGRES_USER (see .env)
    • Password: $POSTGRES_PW (see .env)

Stopping the Containers

To stop the containers, run docker compose down in your terminal.

If you want to remove all data in the containers, run docker compose down -v.

References

https://event-driven.io/en/automatically_connect_pgadmin_to_database/

About

Welcome to my SQL solutions of 8 real-world case studies for #8WeekSQLChallenge!

Topics

Resources

Stars

Watchers

Forks