Question: PLEASE COMPLETE QUESTION IN DETAIL and EXPLAIN UR ANSWERS Question 4 : Consider the following database schema, in which the keys of each relation are
PLEASE COMPLETE QUESTION IN DETAIL and EXPLAIN UR ANSWERS
Question 4 :
Consider the following database schema, in which the keys of each relation are BOLDED
: Restaurant(rname, address, phone, stars)
Chef(cname, specialdish, rating)
CooksFor(cname, rname, salary)
Offers(rname, dishname, price) a) [2 marks] Write a CHECK constraint to ensure that every restaurant has between 0 and 5 stars (inclusive).
b) [2 marks] Write a CHECK constraint to ensure that no restaurant offers a dish that costs less than 5.00.
c) [3 marks] Write an assertion to ensure that every restaurant must have at least one chef.
d) [3 marks] Write an assertion to ensure that for every dish, there is at least one chef for whom that is their special dish.
e) [5 marks] When the number of stars assigned to a restaurant increases, then all chefs who cook for that restaurant must receive a 10% raise. Write a trigger that will modify salary accordingly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
