Consider the following schema for Order Database:
- SALESMAN(Salesman_id, Name, City, Commission)
- CUSTOMER(Customer_id, Cust_Name, City, Grade, Salesman_id)
- ORDERS(Ord_No, Purchase_Amt, Ord_Date, Customer_id, Salesman_id)
Write SQL queries to
- Count the customers with grades above Bangalore’s average.
- Find the name and numbers of all salesman who had more than one customer.
- List all the salesman and indicate those who have and don’t have customers in their cities (Use UNION operation.)
- Create a view that finds the salesman who has the customer with the highest order of a day.
- Demonstrate the DELETE operation by removing salesman with id 1000. All his orders must also be deleted.