Starting from:

$30

Homework 2 Solution

In the second homework, the students start implementation of their startup. To this end, they are going to create a database system, where all data is stored in a DBMS, and the startup functionalities are going to be implemented via a client. The client will accept commands from command-line, and perform the operations as stated below.




(20 points) The students use a RDBMS. You can use any RDBMS as long as it supports transaction support (e.g., commit, rollback, etc). See the following links for RDBMS options.

SQLite: https://www.sqlite.org/
PostgreSQL: https://www.postgresql.org/
MySQL: https://www.mysql.com/
The clients need to implement the following command:

SHOW TABLES

Result: table1 \n table2 \n table3 (one table in each line)

You can use the attached example to connect a database.

(40 points) The client should be able to load the attached csv files into RDMS.
Then, for each query in “query.txt”, the client should be able to fetch the correct results. Check your results with the attached results. The client should be able to implement the following commands for each query:
QUERY 1

Results Value1 \n Value2 \n Value3 (one value in each line)

(20 points) The client should be able to insert new data into tables with the following commands: be careful to functional dependencies.
ADD FARMER (name, lastname, zip_code, city, phone_numbers, e-mails)

// Phone_numbers and e-mails are separated by | (e.g.,email1@com|email2@com)

ADD PRODUCT(name, p_date, h_date, h_, altitude, min_temp)

ADD MARKET(name, address, zip_code, city, phone, budget)

REGISTER PRODUCT(F_name, f_lastname, p_name,amount,price, IBAN)

(20 points) The client should be able to insert new bulk data into tables with the following commands: the operations must be atomic (either commits or abort with all data)
ADD FARMERs (name, lastname, zip_code, city, phone_numbers, e-mails): (name, lastname, zip_code, city, phone_numbers, e-mails): (name, lastname, zip_code, city, phone_numbers, e-mails)

// separated by :

ADD PRODUCTs(name, p_date, h_date, h_, altitude, min_temp): (name, p_date, h_date, h_, altitude, min_temp)

ADD MARKETs(name, address, zip_code, city, phone, budget): (name, address, zip_code, city, phone, budget)

REGISTER PRODUCTs(F_name, f_lastname, p_name, IBAN): (F_name, f_lastname, p_name, IBAN)

More products