This repository contains a sample PostgreSQL library database with schema, a Python data generator, and example analytical queries.
library-db-demo/
├── create_schema.sql # Database schema
├── generate_data.py # Data generator (with Faker)
├── requirements.txt # Python dependencies
├── sample_queries.sql # Example analytical queries
└── README.md # Instructions
- PostgreSQL 14+
- Python 3.8+
- Packages listed in
requirements.txt
createdb librarypsql -d library -f create_schema.sqlThe database models a simple library system with the following tables:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtDefault values:
python generate_data.pyWith custom parameters:
python generate_data.py --authors 20 --members 50 --books 30 --reservations 10 --reviews 10psql -d library -f sample_queries.sql