Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COMP 3 2 7 8 Introduction to Database Management Systems Assignment 3 - Relational Algebra, Functional Dependency & BCNF Q 1 Consider the following relational

COMP3278 Introduction to Database Management Systems
Assignment 3- Relational Algebra, Functional Dependency & BCNF
Q1 Consider the following relational tables of FoodWonder, an online food delivery platform:
Restaurants (rID, name, cruise)
Customers (CID, name, VIP)
VIP is a boolean telling whether the customer is a VIP.
Drivers (dID, name)
Orders (OID, rID, CID, dID, orderTime, arrivaltime,
foodRating, driverRating)
Foreign keys:
rID referencing Restaurants (YID)
CID referencing Customers (CID)
dID referencing Drivers (dID)
The time intervals [orderTime, arrivaltime] denotes the period from when the order is
placed by the customer (denoted by CID), to the time that the driver (denoted by IID) pass the
deliver to the customer.
Note that arrivalTime can be NULL for ongoing deliveries.
foodRating and driverRating are the ratings that the customer (denoted by CID) can give in
an order. The rating is an integer from 1(worst) to 5(best).
Please give the expression trees with some optimizations (You can use assignment operator
and more than one trees to answer each question):
[10%] Retrieve the driver ID (dID) and name of the driver(s) who have completed
more than 100 delivery orders.
[10%] Retrieve the restaurant ID (rID) and name of the restaurant(s) that are
categorized as "Thai" cruise restaurants and have an average food rating
(foodRating) of 4 or above.
[15%] Retrieve the distinct driver ID (dID), the name of the first restaurant (rlname), and the
name of the second restaurant (r2 name) for the drivers who have been (or are currently)
delivering orders from two restaurants simultaneously, considering overlapping order time
intervals.
The r1name and r2 name represent the names of two distinct restaurants involved in
the orders.
[15%] Provide a query that utilizes the driverRating column and involves all four tables
(Restaurants, Customers, Drivers, and Orders) in the query execution process.
After providing the textual description of the query, provide the expression tree with
some optimizations for that query.
Q2[15%] Given the relation schema R(A,B,C,D,E) with the following functional dependencies set
F={AE,BCA,DB,EC} which hold onR.
Find and proof all candidate keys in R.
Q3[15%] Given the relation schema R(A,B,C,D,E) with the following functional dependencies set
F={ABE,BC,EBCD} which hold onR.
If R is decomposed to the following R1 and R2
R1=(A,B,D) and R2=(A,C,E)
a. Is the decomposition dependency-preserving? Explain your answer.
b. Suggest two different ways to handle the unpreserved dependencies in the above
decomposition.
Q4[15%] Given the relation schema R(A,B,C,D,E) with the following functional dependencies set
F={ACB,CB,CE,DA} which hold onR.
Give a lossless join and dependency preserving decomposition of R into relations in BCNF. Show
your steps and proof.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions