Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/christianconchari/tp1_chinook_database
https://github.com/christianconchari/tp1_chinook_database
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/christianconchari/tp1_chinook_database
- Owner: ChristianConchari
- Created: 2024-05-16T19:23:54.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-05-29T04:14:28.000Z (8 months ago)
- Last Synced: 2024-05-29T17:07:37.918Z (8 months ago)
- Size: 177 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chinook database SQL practice exercises
This repository contains a series of SQL exercises to practice querying the Chinook database. The Chinook database represents a digital media store, including tables for artists, albums, media tracks, invoices and customers.
## Setup
### 1. Init and run the database on docker container
```bash
docker compose up -d
```
### 2. Populate the database
With the `user_name` and `db_name` defined on the `docker-compose.yaml` file, run the following command to populate the database with the Chinook schema and data:```bash
docker exec -i postgres_container psql -U user_name -d db_name < 2.chinook_pg_serial_pk_proper_naming.sql
```This will create the Chinook database and populate it with data.
### 3. Connect to the database
To connect to the database, run the following command:```bash
docker exec -it postgres_container psql -U user_name -d db_name
```### 4. Run the exercises
You can run the exercises by copying the SQL queries from the `exercise.sql` file and pasting them into the terminal. Or you can run the queries from the file directly by running the following command:```bash
docker exec -i postgres_container psql -U user_name -d db_name < exercise.sql
```