SQL Query Exercises
SQL Query Exercises
city
Prepare a list with order no, purchase amount, customer name and their cities for those orders which
order amount between 500 and 2000
3. Write a SQL statement to know which salesman are working for which customer.
Output of the Query:
4.Write a SQL statement to find the list of customers who appointed a salesman for their jobs who gets
a commission from the company is more than 12%.
5. Write a SQL statement to 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 is above 12% .
6. Write a SQL statement to find the details of a order 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.
7. Write a SQL statement to make a join on the tables salesman, customer and orders in such a form
that the same column of each table will appear once and only the relational rows will come.
8. Write a SQL statement to make a list in ascending order for the customer who works either through a
salesman or by own.
9. Write a SQL statement to make a list in ascending order for the customer who holds a grade less than
300 and works either through a salesman or by own.
10. Write a SQL statement to make a report with customer name, city, order number, order date, and
order amount in ascending order according to the order date to find that either any of the existing
customers have placed no order or placed one or more orders.
11. Write a SQL statement to make a report with customer name, city, order number, order date, order
amount salesman name and commission to find that either any of the existing customers have placed no
order or placed one or more orders by their salesman or by own.
12. Write a SQL statement to make a list in ascending order for the salesmen who works either for one
or more customer or not yet join under any of the customers.