Question: Question: 4 (25 marks) Consider a Customer Order processing database with three tables as given below 1.Customer - captures customer details cust_no 0001 C002 C003

 Question: 4 (25 marks) Consider a "Customer Order processing database with
three tables as given below 1.Customer - captures customer details cust_no 0001

Question: 4 (25 marks) Consider a "Customer Order processing database with three tables as given below 1.Customer - captures customer details cust_no 0001 C002 C003 C004 cust_name John Joseph Peter Pan 2. Item - captures item details item_no item_price 10001 10002 10003 10004 10005 item_name Shoes Umbrella Table TV Fan 120.00 100.50 50.00 1000.80 501.10 3. Orders - captures order details of the items bought by customer order_no cust_no iten_nono_of_units_bought 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 order_date 2019-09-08 2019-01-09 2019-01-09 2019-01-09 2019-05-02 2019-01-03 2019-01-01 2019-11-11 2019-11-11 2019-01-09 C002 C002 C002 C003 C003 C003 C004 0004 2004 C004 10001 10003 10004 10004 10001 10003 10001 10002 10004 10003 Based on the tables given above, answer the following questions 1) Write SQL syntax to 1) Create table 'Orders' with all necessary constraints. 2) Also write an SQL syntax to set the initial value of the column (order_no) to 1001 (order_no is auto_increment) ii) Write an SQL syntax to 1) Modify the table customer and add an attribute 'cust_gender char(1). 2) Also write an SQL syntax to rename the attribute 'cust_gender' to 'gender' for the 'customer' table. 3) Finally, write an SQL syntax to remove the attribute 'gender' from 'customer' table. iii) Write an SQL statement which shows the items bought by customer Joseph' as given below ITEMS | DATEOFORDER Shoes 2019-09-08 Table 2019-01-09 TV 2019-01-09 iv) Write an SQL statement which that shows the details of the item not bought by any customer. v) Write an SQL statement that shows the customer names and the items bought by them as given below Name Joseph Peter Pan Items Shoes, Table, TV Shoes, Table, TV Table, shoes, Umbrella, TV vi) Write an SQL statement to show the total spent by customer 'Joseph' in buying all the items, as given below Name Joseph | Totalspent 1700.80 vii) Write an SQL statement to 1) find the total number of items bought on 9th Jan 2019 2) find the total number of items bought by each customer as shown below Customer | UnitsBought Joseph Peter 8 Pan 10 0900 (21 Marks)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!