Question: undefined Question 5 (20 marks) Given the following relations: Phone phoneID phoneName P001 iphone P002 iphone pro P003 Galaxy P004 Xperia price 7500 11200 7500
undefined
Question 5 (20 marks) Given the following relations: Phone phoneID phoneName P001 iphone P002 iphone pro P003 Galaxy P004 Xperia price 7500 11200 7500 4800 Customer custID C001 C002 C003 C004 custName Rachel David Rachel Ryan CustOrder custID C001 C001 C002 C003 C003 C003 phoneID P003 P001 P002 P001 POO2 P004 phoneCount 2 1 3 2 5 (a) Write a PL/SQL block to display phoneName and price of phoneID P003' using %ROWTYPE. No exception handling is required. The output is shown below (refer to the output format only): phone name: Galaxy phone price: 7500 [6 marks] (b) Write a PL/SQL function named f_totalClient which takes custID as a parameter and then returns the total amount of the customer spent on all the phones bought. If the custID entered does not exist, returns - 1. [6 marks] (c) Write a PL/SQL block to display the phone ID and the total number of phones (named as tot_phone) sold for each phone ID sorted by phone ID in ascending order using a cursor named cur_id. If the total number of phones is less than 3, display [*]" next to tot_phone. The output is shown below (refer to the output format only): phone ID tot_phone PO01 2 [*] POO2 5 POO3 POO4 2 [*] 5 [8 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
