SQL Exercises: Prepare a list with order no, purchase amount, customer name and their cities for those orders which order amount between 500 and 2000
SQL JOINS: Exercise-2 with Solution
Write a SQL statement to make a list with order no, purchase amount, customer name and their cities for those orders which order amount between 500 and 2000.
Sample table: orders
Sample table: customer
Sample Solution :
SELECT a.ord_no,a.purch_amt, b.cust_name,b.city FROM orders a,customer b WHERE a.customer_id=b.customer_id AND a.purch_amt BETWEEN 500 AND 2000;
Output of the Query:
ord_no purch_amt cust_name city 70007 948.50 Graham Zusi California 70010 1983.43 Fabian Johnson Paris
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a SQL statement to prepare a list with salesman name, customer name and their cities for the salesmen and customer who belongs to the same city.
Next: Write a SQL statement to know which salesman are working for which customer.
What is the difficulty level of this exercise?