This repository contains the PostgreSQL database dump and the Bash script for a salon appointment booking system.
The salon database contains 3 tables with relational links (Primary & Foreign Keys):
customers: Salon customers (customer_idSERIAL primary key,phoneUNIQUE,name).services: Services that the salon provides (service_idSERIAL primary key,name).appointments: Booked appointments (appointment_idSERIAL primary key,customer_idandservice_idas foreign keys tocustomersandservices,time).
To restore the database from the SQL dump, execute the following command in a terminal where PostgreSQL is installed:
psql -U postgres < salon.sqlMake the script executable and run it:
chmod +x salon.sh
./salon.sh- The script shows a numbered list of services taken from the database.
- The customer selects a service, enters a phone number and a preferred time.
- If the phone number is not in the database yet, the script asks for the customer's name and saves the new customer.
- The appointment is saved and the script prints a confirmation, for example:
I have put you down for a Cut at 10:30, Ivan.
.
├── salon.sh # Interactive script
├── salon.sql # Database dump
└── README.md
PostgreSQL, Bash, SQL