The document provides instructions for creating tables, inserting sample data, and writing SQL queries on the tables for a database assignment. The tables to be created are Salesman_Details, Customer_Details, and Orders with attributes like salesman ID, name, city, commission, customer ID, name, city, grade, order number, purchase amount, date. Sample data is given to insert into these tables. 11 SQL queries are listed to display lists of salesmen, customers, orders by applying filters on attributes like city, purchase amount range, salesman commission, customer grade etc.
The document provides instructions for creating tables, inserting sample data, and writing SQL queries on the tables for a database assignment. The tables to be created are Salesman_Details, Customer_Details, and Orders with attributes like salesman ID, name, city, commission, customer ID, name, city, grade, order number, purchase amount, date. Sample data is given to insert into these tables. 11 SQL queries are listed to display lists of salesmen, customers, orders by applying filters on attributes like city, purchase amount range, salesman commission, customer grade etc.
(i) Display a list with salesman name, customer name and their cities for the salesmen and customers who belong to the same city. (ii) Display a list with order no, purchase amount, customer name and their cities for those orders which have purchase amount between 500 and 2000. (iii) Create a view, which contains a list with order no, purchase amount, customer name and their cities for those orders which purchase amount between 500 and 2000. (iv) Find which salesmen are working for which customer. Hint: Display a list with customer name, customer city, salesman name and commission (for iii and iv) (v) Find the list of customers who appointed a salesman for their jobs who gets a commission from the company more than 12%. (vi) Find the list of customers who appointed a salesman for their jobs who does not live in the same city where their customer lives, and gets a commission above 11%. Hint: Display a list with customer name, customer city, salesman name, salesman city and commission (vii) Find the details of orders i.e. order number, order date, amount of order, which customer gives the order and which salesman works for that customer and how much commission he gets for an order. (viii) Display a list in ascending order of customer name for the customers who work either through a salesman or by own. (Hint: Display a list with customer name, customer city, customer grade, salesman name and salesman city) (ix) Display a list in ascending order of customer name for the customers who holds a grade less than 300 and works either through a salesman or by own. (Hint: Display a list with customer name, customer city, customer grade, salesman name and salesman city) (x) Display a list in ascending order of salesman name for the salesmen who work either for some customer or not yet join under any of the customers. (Hint: Display a list with customer name, customer city, customer grade, salesman name and salesman city) (xi) Take a cartesian product between salesman_details and customer_details i.e. each salesman will appear for all customers and vice versa.