Lab 5- ER to SQL Mapping
Lab 5- ER to SQL Mapping
Part of this programming assignment will be presented to the lab instructor during the lab.
It has to be submitted to Moodle by next week.
General Rules:
• Cheating and Copying: Any form of cheating or copying from other students' work will result in a zero
grade for all involved students, regardless of who copied from whom. Each assignment must be entirely
unique.
• The instructor will explain to all students what is required, and give some useful hints.
• You will have assignments to be presented and graded during the lab. In case the student did not finish,
he/she will be graded on the finished part.
• Sometimes the lab will span two weeks, a first part will be presented in the first lab session.
• You can ask questions during the lab, regarding what to do, not how to do.
• You can make use of your notes, and any information online including chatGPT and Google.
• You can use your laptops, or the available desktops.
• Please refer to the Student Code of Conduct, all relevant university policies, and the course syllabus for
further penalties related to academic offenses.
• Students that have accommodation letters should contact us as soon as possible.
• Lab attendance is mandatory, any absentee will have a zero for any missing lab.
• In case you have a valid excuse to miss a lab, please present it before the lab for the instructor approval.
Deliverables:
• You are requested to submit a single Word file with the solution for this assignment.
• For parts A and B, use ERDPlus.com to chart the diagrams.
• For the other parts, copy and paste the solutions of your queries from PostgreSQL DBMS. Don’t write the
queries without testing them.
• Add these parts into a single word file, and submit it.
o Use the snipping tool for parts A and B.
o Copy/ Paste the queries from PostgreSQL query tool for parts C and D.
Page 1 of 2
Assignment:
B. Using also ERDPlus, give the relational schema by applying the mapping rules.
a. Indicate the name of each generated table and its attributes.
b. Underline the PKs.
c. Dot underline the FKs or indicate it within parentheses, use arrows to point to the
corresponding PK.
C. Implement the database tables in PostgreSQL DBMS. Write the necessary database SQL DDL queries,
(create table) needed to create the relations.
a. Add the necessary Key constraints: foreign keys and primary keys.
b. Use varchar(10) for all the IDs.
c. Dob is a date, insuredPrice is an integer, all others are strings. Use varchar type for them.
d. Only Description in Courses can be null. All other fields are not null.
e. Information is a multivalued attribute containing all possible personal information of a student.
Be sure to write your own SQL statements and not use any automatic generating tool.
Use the general user you created previously, not postgres.
Page 2 of 2