SQL Exercises: Find out customers who made the order
SQL Query on Multiple Tables: Exercise-4 with Solution
Write a SQL statement that finds out each order number followed by the name of the customers who made the order.
Sample table: orders
Sample table: customer
Sample Solution:
SELECT orders.ord_no, customer.cust_name
FROM orders, customer
WHERE orders.customer_id = customer.customer_id;
Output of the query:
ord_no cust_name 70009 Brad Guzan 70002 Nick Rimando 70004 Geoff Cameron 70005 Brad Davis 70008 Nick Rimando 70010 Fabian Johnson 70003 Geoff Cameron 70011 Jozy Altidor 70013 Nick Rimando 70001 Graham Zusi 70007 Graham Zusi 70012 Julian Green
Explanation:

Pictorial presentation :

Practice Online
Query Visualization:
Duration:

Rows:

Cost:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a SQL statement to display all those orders by the customers not located in the same cities where their salesmen live.
Next: Write a SQL statement that shorts out the customer and their grade who made an order. Each of the customers must have a grade and served by at least a salesman, who belongs to a city.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- React - JavaScript Library
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework