Ex 5
Ex 5
953622104080
EXERCISE 5
Query the database tables and explore natural, equi and outer joins
1.From the following tables write a SQL query to find the salesperson(s) and the customer(s) he
represents. Return Customer Name, city, Salesman, commission.
2. From the following tables write a SQL query to find salespeople who received commissions of
more than 12 percent from the company. Return Customer Name, customer city, Salesman,
commission.
3. From the following tables write a SQL query to locate those salespeople who do not live in the
same city where their customers live and have received a commission of more than 12% from the
company. Return Customer Name, customer city, Salesman, salesman city, commission.
4. From the following tables write a SQL query to display the customer name, customer city, grade,
salesman, salesman city. The results should be sorted by ascending customer_id.
5. From the following tables write a SQL query to find those customers with a grade less than 300.
Return cust_name, customer city, grade, Salesman, salesmancity. The result should be ordered by
ascendin customer_id.
6. Write a SQL statement to generate a list in ascending order of salespersons who work either for one
or more customers or have not yet joined any of the customers.