Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

DB Design Exercises

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Exercises Database Design - 2023 /nvDieu

HO CHI MINH CITY UNIVERSITY OF TRANSPORT


Kiến thức - Kỹ năng - Sáng tạo - Hội nhập
Sứ mệnh - Tầm nhìn
Triết lý Giáo dục - Giá trị cốt lõi

Contents

0 Database & ERD Tool Resources 2

0.1 PostgreSQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

0.2 MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

0.3 SQLServer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

0.4 ERD Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1 Conceptual database design 2

1.1 ER Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2 Mapping to Relational Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Logical database design 3

2.1 Functional Dependencies (FDs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2.2 Amstrong’s Axiom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.3 Closure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.4 Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.5 Normal Form by FDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.6 Multivalued Dependencies (MVDs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.7 Tableau Chase Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.8 More Normal form and Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3 Physical database design 13

1/14
Exercises Database Design - 2023 /nvDieu

0 Database & ERD Tool Resources


0.1 PostgreSQL
1. Server: PostgreSQL
2. IDE: PgAdmin

0.2 MySQL
1. Server: MySQL
2. IDE: WorkBench

0.3 SQLServer
1. Server: SQLSserver
2. IDE: SSMS

0.4 ERD Tool


1. Ofline: TerraER
2. Online: ERD Plus

1 Conceptual database design


1.1 ER Diagram
Exercise 1.1.1
Draw an ER diagram for an entity called HOTEL and include no fewer than five attributes for the entity. Of the five
attributes, include at least one composite attribute and one multivalued attribute.

Exercise 1.1.2
Consider STUDENT entity, and the only attributes of student are student number and name. Let us suppose we have
another entity called HIGH SCHOOL — the high school from which the student graduated. For the HIGH SCHOOL
entity, we will record the high school name and the location (meaning city and state). Draw the ER diagram for it.

Exercise 1.1.3
If we have two entities, a PLANE and a PILOT, and describe the relationship between the two entities as
“A PILOT flies a PLANE.”
What should the relationship read from the side of the other entity?

Exercise 1.1.4
Suppose a college had one dormitory with many rooms. The DOMITORY entity, which is actually a “dormitory room”
entity since there is only one dorm. Dormitory has the attributes room number and singledouble (meaning there are
private rooms and double rooms). Let us suppose the STUDENT entity in this case contains the attributes student
number, student name, and cell telephone number. Draw the ER diagram linking the two entities. Name your
relationships.

Exercise 1.1.5
West Florida Mall
A new mall, West Florida Mall, just had its grand opening three weeks ago in Pensacola, Florida. This new mall is
attracting a lot of customers and stores. West Florida Mall, which is part of a series of malls owned by a parent company,
now needs a database to keep track of the management of the mall in terms of all its stores as well as the owners and
workers in the stores. Before we build a database for this system of malls, the first step will be to design an ER diagram
for the mall owner. We gathered the following initial user specifications about the mall, with which we can start creating
the ER diagram:
1. We need to record information about the mall and each store in the mall. We need to record the mall’s name and
address. A mall, at any point in time, must contain one or more stores.
2/14
Exercises Database Design - 2023 /nvDieu

2. For each store we will need to keep the following information: store number (which will be unique), the name of
the store, location of store (room number), departments, the owner of the store, and manager of the store. Each
store may have more than one department with each department having a manager. Each store will have only one
manager. Each store is owned by only one owner. Each store is located in one and only one mall.
3. A store manager can manage only one store. We must record information on the store manager—the name, Social
Security number, which store he or she is working for, and the salary.
4. The store owner is a person. We will record name, address, and of cell phone about the store owner. A store owner
must own at least one store and may own more than one.

1.2 Mapping to Relational Model


Exercise 1.2.1
Map ERD exercise 1.1.1 to Relational Model

Exercise 1.2.2
Map ERD exercise 1.1.2 to Relational Model

Exercise 1.2.3
Map ERD exercise 1.1.3 to Relational Model

Exercise 1.2.4
Map ERD exercise 1.1.4 to Relational Model

Exercise 1.2.5
Map ERD exercise 1.1.5 to Relational Model

2 Logical database design


2.1 Functional Dependencies (FDs)
Exercise 2.1.1
Consider relation r below:
r: R( A B C D E)
t1 0 0 0 0 0
t2 0 1 1 1 0
t3 1 0 2 2 0
t4 1 0 3 2 0
t5 2 1 4 0 0
Which of the following FDs does r satisfy (why?):

a) A → B
b) AB → D
c) C → BDE
d) E → A
e) A → E

Exercise 2.1.2
Prove that r satisfies X → Y if and only if X is a key of π XY (r).

Exercise 2.1.3
Let r be a relation on R, with X a subset of R. Show that if π X (r) has the same number of tuples as r, then r satisfies
X → Y for any subset Y of R.

3/14
Exercises Database Design - 2023 /nvDieu

Exercise 2.1.4
Prove or disprove the following inference rules for a relation r(R) with W, X, Y, Z subsets of R.
a) X → Y and Z → W imply XZ → Y W .
b) XY → Z and Z → X imply Z → Y .
c) X → Y and Y → Z imply X → Y Z.
d) X → Y , W → Z , and Y ⊇ W imply X → Z.

2.2 Amstrong’s Axiom


Exercise 2.2.1
{ }
Consider F = AB → CD, A → BE, BH → DK, H → BC
Prove by Amstrong: F |= AH → CK

Exercise 2.2.2
{ }
Consider F = AB → E, AG → J, BE → I, E → G, GI → H
Prove by Amstrong: F |= AB → GH

Exercise 2.2.3
{ }
Consider F = A → D, B → CE, E → H, D → E, E → C
Prove by Amstrong:
a) F |= B → H
b) F |= AB → CH

Exercise 2.2.4
{ }
Consider F = D → BK, AB → GK, B → H, CE → AG, H → E, K → G, EH → K, G → AH
Prove by Amstrong:

a) F |= AB → GH
b) F |= DE → AG
c) F |= BH → EK

2.3 Closure
Exercise 2.3.1
Show that for any set of FDs F , F + = (F + )+ .

Exercise 2.3.2
{ R(ABCDE) and set of functional dependencies:
Suppose }
F = A → BC, CD → E, B → D, E → A . Compute:

a) CDF+
b) EF+

Exercise 2.3.3
{ R(ABCDEK) and set of functional dependencies:
Suppose }
F = AB → C, BC → AD, D → E, CK → B . Compute:

a) BCKF+
b) CDF+
c) DF+

4/14
Exercises Database Design - 2023 /nvDieu

Exercise 2.3.4
{ R(ABCDEKGH) and set of functional dependencies:
Suppose }
F = A → BC, E → C, AH → D, CD → E, D → AEH, DH → BC . Compute:
a) AEF+
b) BCDF+

Exercise 2.3.5
Consider:
{ }
F1 = { AB → CD, A → BE, BH → DK, H → BC }
F2 = { AB → E, AG → J, BE → I, E → G, GI →}H
F3 = { A → D, B → CE, E → H, D → E, E → C }
F4 = D → BK, AB → GK, B → H, CE → AG, H → E, K → G, EH → K, G → AH
Compute:
a) AHF+1
b) ABF+2
c) BF+3
d) ABF+3
e) ABF+4
f) DEF+4
g) BHF+4

Exercise 2.3.6
{ }
Consider F = A → B, A → C, CD → E, B → D, E → A
Which of the following functional dependencies is NOT implied by the above set ?
a) CD → AC
b) BD → CD
c) BC → CD
d) AC → BC

Exercise 2.3.7
From Axiom 1, 2, 3 prove Axiom 4, 5 and 6.

Exercise 2.3.8
Prove that inference axioms 1, 2, and 3 are independent. That is, no one of them can be proved from the other two.

Exercise 2.3.9
R(ABCD)
{ having two FDs sets: }
F = { A → B, B → C, AB → D , }
G = A → B, B → C, A → C, A → D
Are the two sets equivalent ?

Exercise 2.3.10
R(ABCD)
{ having two FDs sets: }
F = { A → B, B → C, A → C },
G = A → B, B → C, A → D
Are the two sets equivalent ?

Exercise 2.3.11
R(ACDEH)
{ having two FDs sets: }
F = { A → C, AC → D, E}→ AD, E → H ,
G = A → CD, E → AH
Are the two sets equivalent ?
5/14
Exercises Database Design - 2023 /nvDieu

Exercise 2.3.12
R(ABCDE)
{ having two FDs sets: }
F = { A → BC, A → D, CD → E , }
G = A → BCE, A → ABD, CD → E
Are the two sets equivalent ?

Exercise 2.3.13
R(ABCDE)
{ having two FDs sets: }
F = { AB → C, A → B, B → C, }A → C ,
G = AB → C, A → B, B → C
Are the two sets equivalent ?

Exercise 2.3.14
{ }
Consider F = A → B, B → C, C → A, B → A, A → C
a) Find a minimum cover Fc of F by loop from right to left
b) Find a minimum cover Fc of F by loop from left to right

Exercise 2.3.15
{ }
Consider F = A → BC, B → C, A → B, AB → C
Find a minimum cover Fc of F

Exercise 2.3.16
{ }
Consider F = A → BC, CD → E, B → D, E → A
Find a minimum cover Fc of F

Exercise 2.3.17
{ }
Consider F = B → A, AD → BC, C → ABD
Find a minimum cover Fc of F

Exercise 2.3.18
{ R(ABC),
Consider }
F = { AB → C, A → B}
G = A → B, B → C

a) Find a minimum cover Fc of F


b) Is G a minimal cover of F ? Otherwise give a data instance of R satisfy F but not G

Exercise 2.3.19
{ }
Consider R(ABCDE) , F = AB → CD, B → CD, CD → AE, DE → AB, D → E
Compute Projected Functional Dependencies:
a) π R (ABC) (F )
1

b) π R (BCD) (F )
2

c) π R (CDE) (F )
3

d) π R (ADE) (F )
4

e) π R (BDE) (F )
5

f) π R (AE) (F )
6

g) π R (DE) (F )
7

6/14
Exercises Database Design - 2023 /nvDieu

Exercise 2.3.20
{ R(ABCDEGH) ,
Consider }
F = AB → CD, E → D, ABC → DE, E → AB, D → AG, ACD → BE
Compute Projected Functional Dependencies:
a) π R (ABCD) (F )
1

b) π R (DEGH) (F )
2

c) π R (CDE) (F )
3

d) π R (ADE) (F )
4

e) π R (BDE) (F )
5

f) π R (AE) (F )
6

g) π R (DE) (F )
7

2.4 Keys
Exercise 2.4.1
{ R(ABCDEH) with a set of FDs }
Consider
F = A → B, BC → D, E → C, D → A
What are the candidate keys of R
a) AE, BE
b) AE, BE, DE
c) AEH, BEH, BCH
d) AEH, BEH, DEH

Exercise 2.4.2
{ R(DEGHIJKLM N ) with a set of FDs
Consider }
F = DE → G, D → IJ, EH → KL, K → M, L → N
What is the key for R ?
a) EF
b) DEH
c) DEHKL
d) E

Exercise 2.4.3
{ R(ABCDEKGH) with a set of FDs
Consider }
F = ABC → DE, AB → D, DE → ABCK, E → C
Find all the candidate keys of R

Exercise 2.4.4
{ R(ABCDEGHK) with a set of FDs
Consider }
F = CD → A, EC → H, GHB → AB, C → D, EG → A, H → B, BE → CD, EC → B
Find all the candidate keys of R

2.5 Normal Form by FDs


Exercise 2.5.1
Which normal form of relational scheme below:
{ }
a) R1 (ABC), F1 = A → C
{ }
b) R2 (ABC), F2 = C → B
{ }
c) R3 (ABCD), F3 = A → B, B → A
{ }
d) R4 (ABCD), F4 = D → C, B → A
{ }
e) R5 (ABCD), F5 = B → D, C → D

7/14
Exercises Database Design - 2023 /nvDieu
{ }
f) R6 (ABCDE), F6 = AB → C, B → A, D → A
{ }
g) R7 (ABCDE), F7 = AB → C, C → D, D → A
{ }
h) R8 (ABCDE), F8 = AB → CD, CD → AE, D → A
{ }
i) R9 (ABCDE), F9 = D → A, BC → E, A → C
{ }
j) R10 (ABCDEG), F10 = AB → CG, G → D, B → D
{ }
k) R11 (ABCDE), F11 = E → D, C → B, A → E B → A, D → C
{ }
l) R12 (ABCDE), F12 = AC → B, BD → C, CE → D
m) R13 (ABCD), F13 = ∅

Exercise 2.5.2
{ }
Consider R(ABCD), F = A → C, B → D
a) Keys and Normal form?
b) Decompose R

Exercise 2.5.3
{ }
Consider R(ABCD), F = AC → D
a) Keys and Normal form?
b) Decompose R

Exercise 2.5.4
{ }
Consider R(ABCDE), F = AB → C, B → A, D → A
a) Keys and Normal form?
b) Decompose R

Exercise 2.5.5
{ }
Consider R(ABCDE), F = CD → A, EC → B, AD → C
a) Keys and Normal form?
b) Decompose R

Exercise 2.5.6
{ R(ABCDEGH),
Consider }
F = CD → A, EC → H, GHB → AB, C → D, EG → A, H → B, BE → CD, EC → B
a) Keys and Normal form ?
b) Decompose R

Exercise 2.5.7
{ }
Consider R(ABCD), F = A → B, B → C, D → B
a) Normal form of R ?
b) If R is not good, let try to find a good decomposition for R

Exercise 2.5.8
{ }
Consider R(ABCD), F = A → B, B → C, A → D, D → C
One decomposition ρ of R:
R1 (AB), F1
R2 (AC), F2
R3 (BD), F3
a) Fi ?
b) Keys and Normal form of Ri ?
8/14
Exercises Database Design - 2023 /nvDieu

Exercise 2.5.9
{ R(A B D E M N O P X Y Z V W ),
Consider }
F = D → XM N P E, M P N → EY ABO, M N → ZO, O → V, P → ABW , AB → P, N E → M P
One decomposition ρ of R:
R1 (DXM N P E), F1
R2 (M N P EY ABO), F2
R3 (M N ZO), F3
R4 (OV ), F4
R5 (P ABW ), F5

a) Fi ?
b) Keys and Normal form of Ri ?
c) Evaluate the quality of ρ (Normal form, Conserve information, Conserve FDs)
d) If ρ is not good, let make a improvement of ρ

Exercise 2.5.10
{ R(ABCDEGH),
Consider }
F = CD → A, EC → H, GHB → AB, C → D, EG → A, H → B, BE → CD, EC → B
Evaluate
{ the decomposition below (Normal form,
} Conserve information, Conserve FDs)
ρ = R1 (ABC), R2 (CDEG), R3 (EGH)

Exercise 2.5.11
Give an example of a relation in 3NF that has some prime attribute transitively dependent upon a key

Exercise 2.5.12
Let R1 and R2 be relation schemes with R1 ∩ R2 = X. Show that for any relation r(R1 R2 ) that satisfies X → R2 ,
r = π R1 (r) ▷◁ π R2 (r)

2.6 Multivalued Dependencies (MVDs)


Exercise 2.6.1
Consider relation r below:
r: R( A B C D E)
t1 0 0 1 0 0
t2 0 0 2 1 0
t3 0 2 2 0 1
From data instance R above make R satisfies each MVD below:

a) AB ↠ C
b) AB ↠ E
c) D ↠ C
d) AD ↠ C
e) C ↠ DE

Exercise 2.6.2
{ }
Let R(ABCDE), D = A ↠ BC, A ↠ E, E ↠ CD
Proving by MVDs axiom:

a) D |= A ↠ C
b) D |= A ↠ BD
c) D |= AC ↠ BD
d) D |= AC ↠ BE
e) D |= DE ↠ AC
f) D |= DE ↠ AB

9/14
Exercises Database Design - 2023 /nvDieu

Exercise 2.6.3
{ }
Let R(ABCDGH), D = A ↠ B, B ↠ GH, CD ↠ G
Proving by MVDs axiom:
a) D |= BC ↠ AD
b) D |= BC ↠ GH
c) D |= BC ↠ DG
d) D |= CD ↠ AB
e) D |= CD ↠ BG
f) D |= CD ↠ GH

Exercise 2.6.4
{ }
Let R(ABCGHI), D = A ↠ B, B ↠ HI, CG ↠ H
++
Compute XD :
a) A++
D

b) AG++
D

c) BG++
D
++
d) BCD
e) HG++
D

Exercise 2.6.5
Prove the correctness of inference axioms M1 and M2.

Exercise 2.6.6
Prove the correctness of inference axiom M3.

Exercise 2.6.7
We know axiom M7 is correct from Lemma 8.3
Prove the correctness of inference axiom M4 using axioms M3 and M7.

Exercise 2.6.8
Prove the correctness of inference axiom M5 using axioms M4.

Exercise 2.6.9
Prove the correctness of inference axiom M6 using axioms M1-M5 and M7

2.7 Tableau Chase Test


Exercise 2.7.1
{ }
Consider D = AB → CD, A → BE, BH → DK, H → BC
Prove by Tableau Chase test: D |= AH → CK

Exercise 2.7.2
{ }
Consider D = AB → E, AG → J, BE → I, E → G, GI → H
Prove by Tableau Chase test: D |= AB → GH

Exercise 2.7.3
{ }
Consider D = A → D, B → CE, E → H, D → E, E → C
Prove by Tableau Chase test:
a) D |= B → H
b) D |= AB → CH
10/14
Exercises Database Design - 2023 /nvDieu

Exercise 2.7.4
{ }
Consider D = D → BK, AB → GK, B → H, CE → AG, H → E, K → G, EH → K, G → AH
Prove by Tableau Chase test:
a) D |= AB → GH
b) D |= DE → AG
c) D |= BH → EK

Exercise 2.7.5
{ R(ABCDE) and set of functional dependencies:
Suppose }
D = A → BC, CD → E, B → D, E → A . Using Tableau Chase test to compute:
+
a) CDD
+
b) ED

Exercise 2.7.6
{ R(ABCDEK) and set of functional dependencies:
Suppose }
D = AB → C, BC → AD, D → E, CK → B . Using Tableau Chase test to compute:
+
a) BCKD
+
b) CDD
+
c) DD

Exercise 2.7.7
{ R(ABCDEKGH) and set of functional dependencies:
Suppose }
D = A → BC, E → C, AH → D, CD → E, D → AEH, DH → BC . Using Tableau Chase test to compute:
+
a) AED
+
b) BCDD

Exercise 2.7.8
Consider:
{ }
D1 = { AB → CD, A → BE, BH → DK, H → BC }
D2 = { AB → E, AG → J, BE → I, E → G, GI →}H
D3 = { A → D, B → CE, E → H, D → E, E → C }
D4 = D → BK, AB → GK, B → H, CE → AG, H → E, K → G, EH → K, G → AH
Using Tableau Chase test to compute:
+
a) AHD1
+
b) ABD 2
+
c) BD 3
+
d) ABD 3
+
e) ABD 4
+
f) DED4
+
g) BHD4

Exercise 2.7.9
{ }
Consider D = A → B, A → C, CD → E, B → D, E → A
Using Tableau Chase test to compute: Which of the following functional dependencies is NOT implied by the above
set ?
a) CD → AC
b) BD → CD
c) BC → CD
d) AC → BC
11/14
Exercises Database Design - 2023 /nvDieu

Exercise 2.7.10
{ }
Let R(ABCDE), D = A ↠ BC, A ↠ E, E ↠ CD
Using Tableau Chase test to compute:

a) D |= A ↠ C
b) D |= A ↠ BD
c) D |= AC ↠ BD
d) D |= AC ↠ BE
e) D |= DE ↠ AC
f) D |= DE ↠ AB

Exercise 2.7.11
{ }
Let R(ABCDGH), D = A ↠ B, B ↠ GH, CD ↠ G
Using Tableau Chase test to compute:
a) D |= BC ↠ AD
b) D |= BC ↠ GH
c) D |= BC ↠ DG
d) D |= CD ↠ AB
e) D |= CD ↠ BG
f) D |= CD ↠ GH

2.8 More Normal form and Dependencies


Exercise 2.8.1
Modify the relation r below to satisfy the MVDs A ↠ BC and CD ↠ BE by adding rows.
r: R( A B C D E )
t1 0 0 0 0 0
t2 0 1 0 1 0
t3 1 0 0 0 1

Exercise 2.8.2
Prove that if a relation r(R) satisfies the MVDs X ↠ Y1 , X ↠ Y2 ... X ↠ Yk , where R = XY1 Y2 ...Yk , then r
decomposes converse information onto the relation schemes XY1 , XY2 , ..., XYk .

Exercise 2.8.3
Let r(R) be a relation where R1 ⊆ R, R2 ⊆ R and R = R1 R2 . Prove that r = π R1 (r) ▷◁ π R2 (r) if and only if:
Count(π R ([X = x](r))) = Count(π R1 ([X = x](r))) × Count(π R2 ([X = x](r))) for every X-value x in r

Exercise 2.8.4
Prove that if relation r(R) satisfies X ↠ Y and Z = R − XY , then
π Z (σ X=x (r)) = π Z (σ XY =xy (r))
for every XY -value xy in r

Exercise 2.8.5
Let relation scheme R} and let W, X, Y, Z ⊆ R. Show that:
{
X ↠ Y , Z ⊆ W |= XW ↠ Y Z

Exercise 2.8.6
Prove the correctness of inference axiom M6 using axioms M1-M5 and M7

Exercise 2.8.7
} let X, Y, Z ⊆ R. Show that:
{ relation scheme R and
Let
X ↠ Y , XY → Z |= X → Z − Y
12/14
Exercises Database Design - 2023 /nvDieu

3 Physical database design


Exercise 3.0.1
Sales and order management system:

• Customers: Stores information about customers, such as name, address, phone number, and email.
• Products: Stores information about the products, such as name, price, quantity, and description.
• Orders: Stores information about orders, such as order date.
• Invoice: Stores information about the invoice, such as invoice date, amount, tax, and total value.

The relationships between entities are described as follows:

• A customer can place multiple orders.


• An order can include many products and corresponding quantities ordered.
• An invoice can be created from an order to calculate delivery charges. Delivered goods may have a different
quantity than when ordered and the unit price may be different from the original unit price in stock.

Request:

1. Conceptual Model Design (EER).


2. Switch to the relational model.
3. Logical design.
4. Physical design.

Exercise 3.0.2
Order and Delivery Management System: (considered by ChatGPT)
You are tasked with designing an ERD for a complex order and delivery management system for a global e-commerce
platform. This system handles orders for a wide range of products and manages deliveries across multiple regions.
Consider the following entities and relationships:
Entities:

1. Customer
2. Product
3. Order
4. Delivery
5. Warehouse
6. Shipping Carrier
7. Payment
8. Address
9. Region

Relationships:

• Customers can place multiple orders.


• Each order is associated with one customer.
• Orders can contain multiple products, and products can be in multiple orders.
• Each order requires a payment, and payments are associated with orders.
• Orders are shipped through deliveries, and each order is associated with one delivery.
• Deliveries can be assigned to different warehouses, and warehouses can handle multiple deliveries.
• Deliveries are assigned to specific shipping carriers.
13/14
Exercises Database Design - 2023 /nvDieu

• Deliveries are made to customer addresses, which are linked to regions.


• Regions represent different geographical areas where deliveries are made.

Requirements:

1. Conceptual Model Design (EER).


2. Switch to the relational model.

3. Logical design.
4. Physical design.

Exercise 3.0.3
Restaurant Order and Delivery with Special Orders: (considered by ChatGPT)
a high-end restaurant’s order and delivery management system. This restaurant not only handles regular menu items but
also allows customers to place special orders with unique customization requests. Here are some additional complexities
to consider:
Entity:

1. Customer
2. Order
3. Menu Item

4. Special Order
5. Ingredient
6. Delivery Driver

7. Delivery Location
8. Table (for dine-in orders)

Relationships:

• Customers can place multiple orders.

• Each order is associated with one customer.


• Orders can include multiple regular menu items, and menu items can be in multiple orders.
• Customers can place special orders with specific ingredient customizations, and these special orders are associated
with regular menu items.

• Special orders can have multiple ingredients, and ingredients can be in multiple special orders.
• Some orders are for dine-in, and some are for delivery.
• Each delivery order is associated with one delivery driver and one delivery location.

• For dine-in orders, orders are associated with a specific table.

Requirements:

1. Conceptual Model Design (EER).

2. Switch to the relational model.


3. Logical design.
4. Physical design.

14/14

You might also like