The project proposes a management system for gas stations and owning companies. Each station is identified by a code and linked to a company with details about its location, types of fuel, and pumps. The companies, with a unique code, have a regional manager and a specific office. Employees, identified by their fiscal code, work at company stations, with monitoring of the weekly plan. The goal is to simplify the management of operations and human resources, paying attention to possible inconsistencies.
These plots were generated using this script
-
Clone the Repository from GitHub:
git clone https://github.com/6eero/Gas-Station-Database-Management-System
-
Navigate to the Cloned Project Directory: Use the
cd
command to navigate into the directory of the cloned project:cd Gas-Station-Database-Management-System
-
Start PostgreSQL Shell (psql): Start the PostgreSQL shell by typing the command:
psql -U postgres
-
Create the Database: Once inside the PostgreSQL shell, create a new database using the command:
CREATE DATABASE fuelstationdatabase;
-
Exit PostgreSQL Shell: To exit the PostgreSQL shell, type
exit
and press Enter. -
Reopen PostgreSQL Shell with Specified Database: Re-enter the PostgreSQL shell specifying the created database and the
postgres
user using the command:psql -d fuelstationdatabase -U postgres
-
Run the SQL Script: Inside the PostgreSQL shell, run the SQL script using the command:
\i fuelstationdatabase.sql
-
Run the R Script: In another shell with PostgreSQL open, launch the R script using the command:
Rscript populate_tables.R
These commands will allow you to set up your environment and run the necessary scripts for your project, including database setup and executing the R script. Now, to see contents from tables you can use:
SELECT * FROM table_name;
If you wish to perform operations (insertions, updates, deletions, queries), please use the following command:
\i operations.sql
To generate plots, please use the following script:
RScript plots.R
The outcome of the project is a consistently populated database. The task processing led to the development of an Entity-Relationship schema followed by its translation into a relational model. Ultimately, the creation of graphs facilitated a deeper understanding of the distribution and consistency of the generated data.