0% found this document useful (0 votes)
20 views4 pages

UML Logical Modelling Exercises - Solutions

This document contains examples and solutions for logical data modeling exercises. It includes conceptual models and possible relational representations, discussing normalization and foreign keys. Correct relational representations must account for entity relationships like an item belonging to only one other entity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

UML Logical Modelling Exercises - Solutions

This document contains examples and solutions for logical data modeling exercises. It includes conceptual models and possible relational representations, discussing normalization and foreign keys. Correct relational representations must account for entity relationships like an item belonging to only one other entity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

LOGICAL DATA MODELLING

Exercises and Solutions

(Note: Solutions are highlighted in yellow)

Question 1. Is the following database normalised? Explain your answer.

OrderID OrderDate Customer Product ProductName


ID ID
10248 7/4/1996 90 11 Queso Cabrales
10249 7/5/1996 81 14 Tofu
10255 7/12/1996 68 2 Chang
10258 7/17/1996 20 2 Chang
10258 7/17/1996 20 5 Chef Anton's Gumbo Mix
10342 10/30/1996 25 2 Chang
10344 11/1/1996 89 4 Chef Anton's Cajun Seasoning

Answer: No, ProductName is an attribute of Product, therefore, being in the same table as the order
information causes addition, delete and update problems.

To be normalized, ProductName should be deleted from this relation, making ProductID a foreign Key to a new
relation, which should contain ProductID and ProductName.

Similarly, OrderData is an attribute of Order.

The table should only contain OrderID and Customer ID, and Product ID.

Question 2. Which relation/s could correctly belong to the relational model of the following conceptual
model:

A. SuperMarket(ID, Address, AisleID)


B. SuperMarket(ID, Address); AisleInSupermarket(SupermarketID, AisleID);
C. SuperMarket(ID, Address); Aisle(ID, Location, SupermarketID);
D. None of the previous.

Feedback: In the relation SuperMarket(ID, Address, AisleID), AisleID would be a list according to the maximum
cardinality Supermarket->Aisle, which is not allowed. In addition, the AisleInSupermarket(SupermarketID,
AisleID) relation would allow an Aisle to be part of many Supermarkets.

Since an Aisle can only belong to one supermarket, the assotiation should be represented as a foreign key
within the Aisle relation.
Question 3. Which relation could correctly belong to the relational model of the following conceptual
model:

A. Aisle(ID, Location, AisleIDNextTo); AisleNextToAisle(AisleID, AisleIDNextTo);


B. AisleNextToAisle(AisleID, AisleIDNextTo);
C. Aisle(ID, Location, AisleIDNextTo);
D. None of the previous.

Feedback: In the relation Aisle(ID, Location, AisleIDNextTo), AisleIDNextTo would be a list (according to the
cardinality 0..*), which is not allowed.

Question 4. Which of the following relations could correspond to the following class diagram?

A. DEPARTMENT

DepartmentNumber DNAME DLOCATION


15 Marketing Brussels
23 Finance Brussels
47 Logistics Antwerp

B. EMPLOYEE

SSN NAME DepartmentNumber


123456789 John Smith 23
999887777 Jennifer Wallace 47
453453453 James English 23

C. DEPARTMENT

DepartmentNumber DNAME DLOCATION


15 Marketing Brussels
R&D Leuven
47 Logistics Antwerp

D. DEPARTMENT_ASSIGNMENT, assuming John Smith (SSN=123456789), James English


(SSN=453453453), and Jennifer Wallace (SSN=999887777) are employees.
DepartmentNumber SSN
15 123456789
23 123456789
23 999887777

Feedback

B. Feedback: an employee can work in more than one department, therefore, DepartmentNumber cannot be a
column as its value could be a list.
C. Feedback: Primary key cannot be NULL.
D. Feedback: Belonging to a department is mandatory (minimum cardinality at the side of Department is 1),
and according to this table James English does not belong to a department.

Question 5. Which of the following relations could correspond to the following class diagram? Explain
your answer.

A. Aisle B. SuperMarket

ID SupermarketID ID Address RetailCompany


15 3 1 Parkstraat 2, Brussels 4
23 5 2 Mataderos 2312, Ghent 6
47 8 3 Forsstraat 57, Ghent
15 10 4 ObereStraat 6, Brugge 3
2 8

C. SupermarketInRetail D. RetailCompany

SupermarketID RetailCompanyID ID Location


3 1 1 Brussels
5 2 2 Brussels
8 3 3 Brugge
10 4 4 Ghent

Feedback

A: Having SupermarketID as part of the primary key allows an aisle to be part of many supermarkets (e.g., aisle
15 belongs to 2 different supermarkets). To be correct, SupermarketID shoudn’t be part of the primary key,
and aisle 15 should belong only to 1 supermarket.

B: A supermarket must belong to a retail company, and therefore the attribute cannot be NULL.
C. Since a supermarket belongs to only one retail company, the association with RetailCompany must be
represented as a foreign key within the Supermarket relation, otherwise a supermarket could belong to more
than one retail company.

Question 6. Create a normalised relational model (i.e., indicate the relations) for the following
conceptual model:

Answer:
OWNER (Passport, Name, Email)
PET(ID, AnimalType, OwnerPassport)

Question 7. Create a normalised relational model for the following conceptual model:

Possible answer:
SHOP (ID, address,)
CUSTOMER (Passport, address, email, ....)
SHOPPING (CustomerPassport, ShopID)

You might also like