This repository contains scripts and data for the Database Lab Project 2024, focused on setting up, populating, and testing a PostgreSQL database environment.
- Write commit messages in English.
- Follow the Conventional Commits specification.
- Docker (Ensure Docker is installed and running)
git clone https://github.com/mrBymax/database-lab-project-2024
cd database-lab-project-2024- Make the setup script executable:
chmod +x run.sh- Run the setup script:
./run.sh- Ensure Docker is running.
- Run the batch script:
.\run.batThese scripts will:
- Build database tables, triggers, and populate them with sample data.
- Run test cases and statistical scripts.
After successful execution of the setup scripts, the database is populated with sample data and accessible using these credentials:
| Credential | Value |
|---|---|
| Host | localhost |
| Port | 6432 (custom) |
| Username | db |
| Password | db |
| Database | db |
⚠️ Security Notice:
Credentials are stored in the.envfile. Do NOT deploy this database publicly without changing default credentials, as it poses a security risk.
-
All outputs, including SQL test results and R statistical analyses, are stored in the directory specified by the environment variable
OUT_DIR(default:./output). -
Key files in the output directory:
02a-query-examples.txt: Summarizes queries executed. The summary is found at the end of the file.02b-constraint-test.txt: Summarizes constraint test results. The summary is found at the end of the file.
- Beekeeper Studio (Free, Open-Source)
- Graphical interface for PostgreSQL database exploration.
- Use the
.envcredentials to connect.
├───data-sources
│ cities.txt
│ ...
│
├───DB_Lab_Report
│ │ DB_Lab_Report.pdf # The project report
│ │ ...
│
├───output
│ │ 01-populate.txt
│ │ 02a-query-examples.txt # Summary and results of queries
│ │ 02b-constraint-test.txt # Summary and results of constraint tests
│ │ 03-Q1Stats.txt
│ │ 04-Q2Stats.txt
│ │ 05-Q3Stats.txt
│ │ 06-Q4Stats.txt
│ │
│ └───plots
│ q1_married_data_pie_chart.png
│ q2_top_10_number_of_workers_per_job_title.png
│ q3_top_10_projects_by_skills.png
│ q4_employees_per_city.png
│
└───scripts
├───r_scripts
│ 01-populate.r
│ 02a-query-examples.r
│ 02b-constraint-test.r
│ 03-Q1Stats.r
│ 04-Q2Stats.r
│ 05-Q3Stats.r
│ 06-Q4Stats.r
│ DESCRIPTION # R package description
│
└───sql_scripts
01-init.sql
02-triggers.sql
03-queries.sql
04-test-triggers.sql