Poznan University of Technology, AI Specialization
Instructor: Dr. Serhii Baraban
Course: Database Systems
Topic: Entity and Referential Integrity, ERD, and Relational Diagrams
This practical assignment develops your ability to:
- Identify primary and foreign keys in relational tables
- Verify entity and referential integrity
- Recognize types of relationships between entities
- Create ER diagrams (conceptual level)
- Create relational diagrams (logical level)
- Explain integrity constraints and key dependencies
You will use three example databases shown in the textbook figures:
- Figure P3.1 โ Ch03_StoreCo Ch03_StoreCo Tables
- Figure P3.10 โ Ch03_BeneCo Ch03_BeneCo Tables
- Figure P3.17 โ Ch03_TransCo Ch03_TransCo Tables
Each database consists of multiple related tables. The figures are provided in the /docs/ folder:
fig_3_1.pngโ StoreCo Databasefig_3_10.pngโ BeneCo Databasefig_3_17.pngโ TransCo Database
Use the database shown in Figure P3.1 to answer Problems 1โ9.
- For each table, identify the primary key and the foreign key(s). If a table does not have a foreign key, write
None. - Do the tables exhibit entity integrity? Answer Yes or No, and explain your reasoning.
- Do the tables exhibit referential integrity? Answer Yes or No, and explain. Write
N/Aif the table does not have a foreign key. - Describe the type(s) of relationship(s) between
STOREandREGION. - Create the ERD showing the relationship between
STOREandREGION. - Create the relational diagram showing the relationship between
STOREandREGION. - Describe the type(s) of relationship(s) between
EMPLOYEEandSTORE.
Hint: Each store employs many employees, one of whom manages the store. - Create the ERD for the relationship between
EMPLOYEEandSTORE. - Create the relational diagram for the same relationship.
Use the database shown in Figure P3.10 to answer Problems 10โ16.
The database contains four tables that reflect these relationships:
- An
EMPLOYEEhas only oneJOB_CODE, but aJOB_CODEcan be held by many employees. - An
EMPLOYEEcan participate in manyPLANs, and anyPLANcan be assigned to many employees. - The M:N relationship between
EMPLOYEEandPLANis resolved by theBENEFITtable, which acts as a bridge (composite) entity.
- For each table, identify the primary key and the foreign key(s). If none, write
None. - Create the ERD showing the relationship between
EMPLOYEEandJOB. - Create the relational diagram for the same relationship.
- Do the tables exhibit entity integrity? Answer and justify.
- Do the tables exhibit referential integrity? Answer and justify. Write
N/Aif not applicable. - Create the ERD showing the relationships among
EMPLOYEE,BENEFIT,JOB, andPLAN. - Create the relational diagram for the same four entities.
Use the database shown in Figure P3.17 to answer Problems 17โ23.
- For each table, identify the primary key and the foreign key(s). If none, write
None. - Do the tables exhibit entity integrity? Explain.
- Do the tables exhibit referential integrity? Explain. Write
N/Aif no foreign key exists. - Identify the
TRUCKtableโs candidate key(s). - For each table, identify a superkey and a secondary key.
- Create the ERD for the TransCo database.
- Create the relational diagram for the TransCo database.
| File | Description |
|---|---|
README.md |
Contains written answers for all questions |
/diagrams/StoreCo_ERD.png |
ERD for Figure P3.1 |
/diagrams/BeneCo_ERD.png |
ERD for Figure P3.10 |
/diagrams/TransCo_ERD.png |
ERD for Figure P3.17 |
/diagrams/*.png |
Corresponding relational diagrams |
/report/explanation.pdf |
Optional structured report with detailed reasoning |
- pgAdmin 4 or DBeaver for schema visualization
- draw.io, Lucidchart, or Visual Paradigm for ERD diagrams
- Markdown for answers (
README.md) - Export diagrams as
.pngfor inclusion in the/diagrams/folder
| Aspect | Weight | Description |
|---|---|---|
| Key & Integrity Analysis | 25% | Correctly identifies PK/FK and explains integrity |
| ERDs | 25% | Clear, consistent Crowโs Foot or UML notation |
| Relational Diagrams | 25% | Logical accuracy and correct relationships |
| Explanations / Reasoning | 15% | Completeness and clarity |
| Repository Structure | 10% | Organization, clarity, and GitHub commit quality |
- Complete your assignment and verify diagrams are readable.
- Commit and push all changes to your GitHub Classroom repository before the deadline.
- Ensure all required files are present and correctly named.
Example commit:
git add .
git commit -m "Final submission โ Database Integrity and ERD Assignment"
git push origin main