Compare commits

...

7 Commits

Author SHA1 Message Date
5f6a40ce96 Remove bad word :( 2024-12-14 02:45:48 +01:00
88a9d623f6 Add number_guess.sh 2024-11-03 02:49:43 +00:00
af5579157d Add number_guess.sql 2024-11-03 02:49:22 +00:00
6685c97f21 Add element.sh 2024-11-03 01:48:12 +00:00
9ba3d272ac Add periodic_table.sql 2024-11-03 01:47:41 +00:00
502e273cb9 Add salon.sql 2024-11-02 23:22:03 +00:00
3fcba5d995 Add salon.sh 2024-11-02 23:21:12 +00:00
6 changed files with 786 additions and 0 deletions

28
element.sh Normal file
View File

@@ -0,0 +1,28 @@
#!/bin/bash
PSQL="psql --username=freecodecamp --dbname=periodic_table -t --no-align -c"
if [[ ! $1 ]]; then
echo "Please provide an element as an argument."
exit 0
fi
if [[ $1 =~ ^[0-9]+$ ]]; then
ELEMENT_RESULT=$($PSQL "SELECT elements.atomic_number, symbol, name, atomic_mass, melting_point_celsius, boiling_point_celsius, type FROM elements INNER JOIN properties USING(atomic_number) INNER JOIN types USING(type_id) WHERE atomic_number = $1")
else
ELEMENT_RESULT=$($PSQL "SELECT elements.atomic_number, symbol, name, atomic_mass, melting_point_celsius, boiling_point_celsius, type FROM elements INNER JOIN properties USING(atomic_number) INNER JOIN types USING(type_id) WHERE symbol = '$1' OR name = '$1'")
fi
if [[ -z $ELEMENT_RESULT ]]; then
echo "I could not find that element in the database."
exit 0
fi
ATOMIC_NUMBER=$(echo "$ELEMENT_RESULT" | cut -d'|' -f1)
SYMBOL=$(echo "$ELEMENT_RESULT" | cut -d'|' -f2)
NAME=$(echo "$ELEMENT_RESULT" | cut -d'|' -f3)
ATOMIC_MASS=$(echo "$ELEMENT_RESULT" | cut -d'|' -f4)
MELTING_POINT=$(echo "$ELEMENT_RESULT" | cut -d'|' -f5)
BOILING_POINT=$(echo "$ELEMENT_RESULT" | cut -d'|' -f6)
TYPE=$(echo "$ELEMENT_RESULT" | cut -d'|' -f7)
echo "The element with atomic number $ATOMIC_NUMBER is $NAME ($SYMBOL). It's a $TYPE, with a mass of $ATOMIC_MASS amu. $NAME has a melting point of $MELTING_POINT celsius and a boiling point of $BOILING_POINT celsius."

52
number_guess.sh Normal file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
PSQL="psql --username=freecodecamp --dbname=number_guessing_game -t --no-align -c"
NUMBER=$((1 + $RANDOM % 1000))
echo "Enter your username:"
read USERNAME
USER_QUERY=$($PSQL "SELECT username, games_played, best_game FROM users WHERE username = '$USERNAME'")
if [[ -z $USER_QUERY ]]; then
echo "Welcome, $USERNAME! It looks like this is your first time here."
INSERT_USER=$($PSQL "INSERT INTO users(username) VALUES('$USERNAME')")
BEST_GAME=""
else
GAMES_PLAYED=$(echo "$USER_QUERY"| cut -d'|' -f2)
BEST_GAME=$(echo "$USER_QUERY"| cut -d'|' -f3)
echo "Welcome back, $USERNAME! You have played $GAMES_PLAYED games, and your best game took $BEST_GAME guesses."
fi
GUESSES=1
echo "Guess the secret number between 1 and 1000:"
read GUESS
while [[ $GUESS -ne $NUMBER ]]; do
if [[ ! $GUESS =~ ^[0-9]+$ ]]; then
echo "That is not an integer, guess again:"
read GUESS
continue
fi
if [[ $NUMBER -lt $GUESS ]]; then
echo "It's lower than that, guess again:"
((GUESSES++))
else
echo "It's higher than that, guess again:"
((GUESSES++))
fi
read GUESS
done
echo "You guessed it in $GUESSES tries. The secret number was $NUMBER. Nice job!"
if [[ $GUESSES -lt $BEST_GAME || -z $BEST_GAME ]]; then
UPDATE_USER=$($PSQL "UPDATE users SET best_game = $GUESSES WHERE username = '$USERNAME'")
fi
UPDATE_USER=$($PSQL "UPDATE USERS SET games_played = games_played + 1 WHERE username = '$USERNAME'")

125
number_guess.sql Normal file
View File

@@ -0,0 +1,125 @@
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.17 (Ubuntu 12.17-1.pgdg22.04+1)
-- Dumped by pg_dump version 12.17 (Ubuntu 12.17-1.pgdg22.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP DATABASE number_guessing_game;
--
-- Name: number_guessing_game; Type: DATABASE; Schema: -; Owner: freecodecamp
--
CREATE DATABASE number_guessing_game WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';
ALTER DATABASE number_guessing_game OWNER TO freecodecamp;
\connect number_guessing_game
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: users; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.users (
user_id integer NOT NULL,
games_played integer DEFAULT 0 NOT NULL,
best_game integer,
username character varying(22) NOT NULL
);
ALTER TABLE public.users OWNER TO freecodecamp;
--
-- Name: users_user_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--
CREATE SEQUENCE public.users_user_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.users_user_id_seq OWNER TO freecodecamp;
--
-- Name: users_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--
ALTER SEQUENCE public.users_user_id_seq OWNED BY public.users.user_id;
--
-- Name: users user_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.users ALTER COLUMN user_id SET DEFAULT nextval('public.users_user_id_seq'::regclass);
--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
INSERT INTO public.users VALUES (32, 2, 7, 'Faab');
INSERT INTO public.users VALUES (34, 2, 401, 'user_1730602033338');
INSERT INTO public.users VALUES (33, 5, 141, 'user_1730602033339');
INSERT INTO public.users VALUES (36, 2, 55, 'user_1730602067068');
INSERT INTO public.users VALUES (35, 5, 69, 'user_1730602067069');
--
-- Name: users_user_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--
SELECT pg_catalog.setval('public.users_user_id_seq', 36, true);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (user_id);
--
-- Name: users users_username_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_username_key UNIQUE (username);
--
-- PostgreSQL database dump complete
--

237
periodic_table.sql Normal file
View File

@@ -0,0 +1,237 @@
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.17 (Ubuntu 12.17-1.pgdg22.04+1)
-- Dumped by pg_dump version 12.17 (Ubuntu 12.17-1.pgdg22.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP DATABASE periodic_table;
--
-- Name: periodic_table; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE periodic_table WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';
ALTER DATABASE periodic_table OWNER TO postgres;
\connect periodic_table
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: elements; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.elements (
atomic_number integer NOT NULL,
symbol character varying(2) NOT NULL,
name character varying(40) NOT NULL
);
ALTER TABLE public.elements OWNER TO freecodecamp;
--
-- Name: properties; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.properties (
atomic_number integer NOT NULL,
atomic_mass real NOT NULL,
melting_point_celsius numeric NOT NULL,
boiling_point_celsius numeric NOT NULL,
type_id integer NOT NULL
);
ALTER TABLE public.properties OWNER TO freecodecamp;
--
-- Name: types; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.types (
type_id integer NOT NULL,
type character varying(20) NOT NULL
);
ALTER TABLE public.types OWNER TO freecodecamp;
--
-- Name: types_type_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--
CREATE SEQUENCE public.types_type_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.types_type_id_seq OWNER TO freecodecamp;
--
-- Name: types_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--
ALTER SEQUENCE public.types_type_id_seq OWNED BY public.types.type_id;
--
-- Name: types type_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.types ALTER COLUMN type_id SET DEFAULT nextval('public.types_type_id_seq'::regclass);
--
-- Data for Name: elements; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
INSERT INTO public.elements VALUES (1, 'H', 'Hydrogen');
INSERT INTO public.elements VALUES (2, 'He', 'Helium');
INSERT INTO public.elements VALUES (3, 'Li', 'Lithium');
INSERT INTO public.elements VALUES (4, 'Be', 'Beryllium');
INSERT INTO public.elements VALUES (5, 'B', 'Boron');
INSERT INTO public.elements VALUES (6, 'C', 'Carbon');
INSERT INTO public.elements VALUES (7, 'N', 'Nitrogen');
INSERT INTO public.elements VALUES (8, 'O', 'Oxygen');
INSERT INTO public.elements VALUES (9, 'F', 'Fluorine');
INSERT INTO public.elements VALUES (10, 'Ne', 'Neon');
--
-- Data for Name: properties; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
INSERT INTO public.properties VALUES (2, 4.0026, -272.2, -269, 1);
INSERT INTO public.properties VALUES (3, 6.94, 180.54, 1342, 2);
INSERT INTO public.properties VALUES (4, 9.0122, 1287, 2470, 2);
INSERT INTO public.properties VALUES (5, 10.81, 2075, 4000, 3);
INSERT INTO public.properties VALUES (6, 12.011, 3550, 4027, 1);
INSERT INTO public.properties VALUES (7, 14.007, -210.1, -195.8, 1);
INSERT INTO public.properties VALUES (8, 15.999, -218, -183, 1);
INSERT INTO public.properties VALUES (1, 1.008, -259.1, -252.9, 1);
INSERT INTO public.properties VALUES (9, 18.998, -220, -188.1, 1);
INSERT INTO public.properties VALUES (10, 20.18, -248.6, -246.1, 1);
--
-- Data for Name: types; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
INSERT INTO public.types VALUES (1, 'nonmetal');
INSERT INTO public.types VALUES (2, 'metal');
INSERT INTO public.types VALUES (3, 'metalloid');
--
-- Name: types_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--
SELECT pg_catalog.setval('public.types_type_id_seq', 3, true);
--
-- Name: elements elements_atomic_number_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.elements
ADD CONSTRAINT elements_atomic_number_key UNIQUE (atomic_number);
--
-- Name: elements elements_name_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.elements
ADD CONSTRAINT elements_name_key UNIQUE (name);
--
-- Name: elements elements_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.elements
ADD CONSTRAINT elements_pkey PRIMARY KEY (atomic_number);
--
-- Name: elements elements_symbol_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.elements
ADD CONSTRAINT elements_symbol_key UNIQUE (symbol);
--
-- Name: properties properties_atomic_number_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.properties
ADD CONSTRAINT properties_atomic_number_key UNIQUE (atomic_number);
--
-- Name: properties properties_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.properties
ADD CONSTRAINT properties_pkey PRIMARY KEY (atomic_number);
--
-- Name: types types_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.types
ADD CONSTRAINT types_pkey PRIMARY KEY (type_id);
--
-- Name: properties properties_atomic_number_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.properties
ADD CONSTRAINT properties_atomic_number_fkey FOREIGN KEY (atomic_number) REFERENCES public.elements(atomic_number);
--
-- Name: properties properties_type_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.properties
ADD CONSTRAINT properties_type_id_fkey FOREIGN KEY (type_id) REFERENCES public.types(type_id);
--
-- PostgreSQL database dump complete
--

70
salon.sh Normal file
View File

@@ -0,0 +1,70 @@
#!/bin/bash
PSQL="psql --username=freecodecamp --dbname=salon -t --no-align -c"
SELECT_SERVICE() {
if [[ $1 ]]; then
echo -e "\n$1"
fi
SERVICES=$($PSQL "SELECT * FROM services")
echo "$SERVICES" | while IFS="|" read SERVICE_ID SERVICE_NAME; do
echo "$SERVICE_ID) $SERVICE_NAME"
done
read SERVICE_ID_SELECTED
if [[ ! $SERVICE_ID_SELECTED =~ ^[0-9]+$ ]]; then
SELECT_SERVICE "Please use a valid number"
fi
SERVICE=$($PSQL "SELECT service_id, name FROM services WHERE service_id = $SERVICE_ID_SELECTED")
echo $SERVICE
SERVICE_ID=$(echo "$SERVICE" | cut -d '|' -f1)
SERVICE_NAME=$(echo "$SERVICE" | cut -d '|' -f2)
if [[ -z $SERVICE_ID ]]; then
SELECT_SERVICE "This is not a valid service"
fi
}
NEW_CUSTOMER() {
echo -e "\nWhat's your name?"
read CUSTOMER_NAME
CUSTOMER_INSERT=$($PSQL "INSERT INTO CUSTOMERS(phone, name) VALUES('$1','$CUSTOMER_NAME')")
CUSTOMER_ID=$($PSQL "SELECT customer_id FROM customers WHERE phone = '$CUSTOMER_PHONE'")
}
GET_CUSTOMER() {
echo -e "\nWhat's your phone number?"
read CUSTOMER_PHONE
CUSTOMER_RESULT=$($PSQL "SELECT customer_id, name FROM customers WHERE phone = '$CUSTOMER_PHONE'")
if [[ -z $CUSTOMER_RESULT ]]; then
NEW_CUSTOMER $CUSTOMER_PHONE
else
echo $CUSTOMER_RESULT | IFS="|" read CUSTOMER_ID BAR CUSTOMER_NAME
fi
}
SET_APPOINTMENT() {
echo -e "\nAt what time would you like to schedule your appointment?"
read SERVICE_TIME
CREATE_APPOINTMENT=$($PSQL "INSERT INTO appointments(customer_id, service_id, time) VALUES($CUSTOMER_ID,$SERVICE_ID,'$SERVICE_TIME')")
}
echo -e "\n~~~~~ Kapsalon ~~~~~\n"
SELECT_SERVICE
GET_CUSTOMER
SET_APPOINTMENT
echo -e "\nI have put you down for a $SERVICE_NAME at $SERVICE_TIME, $CUSTOMER_NAME."

274
salon.sql Normal file
View File

@@ -0,0 +1,274 @@
--
-- PostgreSQL database dump
--
-- Dumped from database version 12.17 (Ubuntu 12.17-1.pgdg22.04+1)
-- Dumped by pg_dump version 12.17 (Ubuntu 12.17-1.pgdg22.04+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
DROP DATABASE salon;
--
-- Name: salon; Type: DATABASE; Schema: -; Owner: freecodecamp
--
CREATE DATABASE salon WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';
ALTER DATABASE salon OWNER TO freecodecamp;
\connect salon
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: appointments; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.appointments (
appointment_id integer NOT NULL,
customer_id integer NOT NULL,
service_id integer NOT NULL,
"time" character varying(20) NOT NULL
);
ALTER TABLE public.appointments OWNER TO freecodecamp;
--
-- Name: appointments_appointment_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--
CREATE SEQUENCE public.appointments_appointment_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.appointments_appointment_id_seq OWNER TO freecodecamp;
--
-- Name: appointments_appointment_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--
ALTER SEQUENCE public.appointments_appointment_id_seq OWNED BY public.appointments.appointment_id;
--
-- Name: customers; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.customers (
customer_id integer NOT NULL,
phone character varying(15) NOT NULL,
name character varying(40) NOT NULL
);
ALTER TABLE public.customers OWNER TO freecodecamp;
--
-- Name: customers_customer_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--
CREATE SEQUENCE public.customers_customer_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.customers_customer_id_seq OWNER TO freecodecamp;
--
-- Name: customers_customer_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--
ALTER SEQUENCE public.customers_customer_id_seq OWNED BY public.customers.customer_id;
--
-- Name: services; Type: TABLE; Schema: public; Owner: freecodecamp
--
CREATE TABLE public.services (
service_id integer NOT NULL,
name character varying(40) NOT NULL
);
ALTER TABLE public.services OWNER TO freecodecamp;
--
-- Name: services_service_id_seq; Type: SEQUENCE; Schema: public; Owner: freecodecamp
--
CREATE SEQUENCE public.services_service_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.services_service_id_seq OWNER TO freecodecamp;
--
-- Name: services_service_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: freecodecamp
--
ALTER SEQUENCE public.services_service_id_seq OWNED BY public.services.service_id;
--
-- Name: appointments appointment_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.appointments ALTER COLUMN appointment_id SET DEFAULT nextval('public.appointments_appointment_id_seq'::regclass);
--
-- Name: customers customer_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.customers ALTER COLUMN customer_id SET DEFAULT nextval('public.customers_customer_id_seq'::regclass);
--
-- Name: services service_id; Type: DEFAULT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.services ALTER COLUMN service_id SET DEFAULT nextval('public.services_service_id_seq'::regclass);
--
-- Data for Name: appointments; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
--
-- Data for Name: customers; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
--
-- Data for Name: services; Type: TABLE DATA; Schema: public; Owner: freecodecamp
--
INSERT INTO public.services VALUES (1, 'cut');
INSERT INTO public.services VALUES (2, 'color');
INSERT INTO public.services VALUES (3, 'perm');
INSERT INTO public.services VALUES (4, 'style');
INSERT INTO public.services VALUES (5, 'trim');
--
-- Name: appointments_appointment_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--
SELECT pg_catalog.setval('public.appointments_appointment_id_seq', 16, true);
--
-- Name: customers_customer_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--
SELECT pg_catalog.setval('public.customers_customer_id_seq', 34, true);
--
-- Name: services_service_id_seq; Type: SEQUENCE SET; Schema: public; Owner: freecodecamp
--
SELECT pg_catalog.setval('public.services_service_id_seq', 5, true);
--
-- Name: appointments appointments_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.appointments
ADD CONSTRAINT appointments_pkey PRIMARY KEY (appointment_id);
--
-- Name: customers customers_phone_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.customers
ADD CONSTRAINT customers_phone_key UNIQUE (phone);
--
-- Name: customers customers_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.customers
ADD CONSTRAINT customers_pkey PRIMARY KEY (customer_id);
--
-- Name: services services_name_key; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.services
ADD CONSTRAINT services_name_key UNIQUE (name);
--
-- Name: services services_pkey; Type: CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.services
ADD CONSTRAINT services_pkey PRIMARY KEY (service_id);
--
-- Name: appointments appointments_customer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.appointments
ADD CONSTRAINT appointments_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES public.customers(customer_id);
--
-- Name: appointments appointments_service_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: freecodecamp
--
ALTER TABLE ONLY public.appointments
ADD CONSTRAINT appointments_service_id_fkey FOREIGN KEY (service_id) REFERENCES public.services(service_id);
--
-- PostgreSQL database dump complete
--