This project demonstrates various types of SQL joins using a sample PostgreSQL database. It's built for collaborative learning, hands-on practice, and clear demonstration of:
- ✅ Table Aliases
- ✅ Inner Joins
- ✅ Left Joins
- ✅ Full Outer Joins
- ✅ Self Joins
- Python 3.10+
- PostgreSQL installed and added to PATH (for windows users)
python-dotenv
Install dependencies:
python3 -m venv .venv
source .venv/bin/activate
.venv/bin/python3 -m pip install -r requirements.txt
# or .venv\Scripts\activate on Windows
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtCreate a new database manually or via psql:
CREATE DATABASE hospital_dbCreate a .env file in the project root:
DB_NAME=hospital_db
DB_USER=your_postgres_user
DB_PASSWORD=your_postgres_password
DB_HOST=localhost
DB_PORT=5432
python data_loader/load_schema.py
# or for linux users
python3 data_loader/load_schema.py
python converter/convert_to_csv.pypython data_loader/run_copy_commands.py
# or for linux users
python3 data_loader/run_copy_commands.py
-
doctors – Basic doctor details
-
hospitals – Used in joins
-
patients – For left/full joins
-
employees – Self join example via manager_id
-
Fork the repo
-
Create your branch: git checkout -b feature/your-join-demo
-
Make your changes
-
Submit a pull request
- Arman (Arman On Github)
- JohnMwihaki (JohnMwihaki On Github)
- Waithaka Amos WaithakaGuru on Github
- Ivy Mbogo (Ivy Mbogo On Github)
🎉 Happy Coding Champ