Question
Given the following four relations for a simple restaurant management record database application where cost of meals ordered by customers are tracked for each food
Given the following four relations for a simple restaurant management record database application where cost of meals ordered by customers are tracked for each food order. Total number of orders received by each customer is known from the customer record at all times.
Customer(cid, cname, address, numorder)
Chef(chid, chname, specialization, address)
Meal(mealid, meal_name, cost)
Serves(chid, cid, mealid, mdate)
Here, the primary key for each relation is underlined. The attributes cid stands for customer id, chid is chef id, mealid is meal id, numorder is the cumulative number of meal order the customer has made to this restaurant managed by a chef (e.g., 50). All other attributes are self explanatory.
A small database state of this database is:
CUSTOMER
cid | cname | address | numorder |
1111 | John Smith | Windsor | 100 |
2222 | Mary Pert | Windsor | 50 |
CHEF
chid | chname | specialization | address |
1 | Mana Patel | celebrity | Windsor |
2 | Pat Goodman | fish | London |
MEAL
mealid | meal_name | Cost |
23567 | Chicken_rice | 20.45 |
55555 | Fish_potato | 30.50 |
SERVES
chid | cid | mealid | mdate |
1 | 1111 | 23567 | 10-Jan-21 |
2 | 2222 | 55555 | 20-Aug-20 |
- Write the SQL DDL instructions to create all 4 tables of the above database in the Oracle DBMS on our cs server specifying all constraints such as Key, entity and foreign key constraints as usual within each instruction (not separately). (5 marks)
- Using only the data in the above instance (not a new instance formed by you), write the SQL instructions to load (insert) all the data above in the 4 tables you created. (5 marks)
- Write the SQL query for the following query posed on this database, also write the results of the query and the tables involved in answering the query. (5 marks)
Print all meals names and date they are ordered (meal_name, mdate) for customer named Mary Pert.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started