https://github.com/charlieroth/northwind-sql
Personal project to deeply learn SQL
https://github.com/charlieroth/northwind-sql
postgresql sql
Last synced: 2 months ago
JSON representation
Personal project to deeply learn SQL
- Host: GitHub
- URL: https://github.com/charlieroth/northwind-sql
- Owner: charlieroth
- Created: 2025-02-23T21:29:32.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-24T13:01:18.000Z (over 1 year ago)
- Last Synced: 2025-10-08T10:51:46.468Z (9 months ago)
- Topics: postgresql, sql
- Language: Python
- Homepage:
- Size: 122 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `northwind-sql`
`northwind-sql` is a project to learn SQL using the fictional sales data of
the Northwind Traders company, which imports and exports specialtiy foods
from around the world.
The Northwind database is a sample database that was originally created by
Microsoft and used as the basis for their tutorials in a variety of database
products for decades. The Northwind database contains the sales data for a
fictitious company called “Northwind Traders,” which imports and exports
specialty foods from around the world. The Northwind database is an excellent
tutorial schema for a small-business ERP, with customers, orders, inventory,
purchasing, suppliers, shipping, employees, and single-entry accounting.
## Project Details
This project includes a Docker Compose file to start a PostgreSQL database
and run database migrations with the `geni` tool. The project also includes
example queries that cover the following topics:
- SQL Basic
- Manipulating Data
- Mutli-Table Queries
- Aggregate Functions
- Scalar Functions
- Subqueries and Common Table Expressions
- Window Functions
## Project Setup
Clone the repository:
```bash
git clone https://github.com/charlieroth/northwind-sql.git
```
Since this project uses [uv](https://docs.astral.sh/uv/), you can initialize the
virtual environment and install the dependencies with the following command:
```bash
uv sync
```
### Database Setup
The project uses PostgreSQL as the database. To start the database and run
the database migrations, run the following command:
```bash
docker compose up -d
```
## Seed the Database
The file `nortwind-data.sql` contains the SQL statements to populate the tables
with data. To seed the database, run the following command:
```bash
docker exec -i psql -h localhost -p 5432 -U postgres -d northwind < ./northwind-data.sql
```