w3resource
SQL exercises

SQL Subquery Exercises: Display all the orders for the salesman who belongs to the city London

SQL SUBQUERY: Exercise-2 with Solution

2. Write a query to display all the orders for the salesman who belongs to the city London.

Sample table: Salesman

Sample table: Orders

Sample Solution:

SELECT *
FROM orders
WHERE salesman_id =
    (SELECT salesman_id 
     FROM salesman 
     WHERE city='London');

Sample Output:

ord_no	purch_amt	ord_date	customer_id	salesman_id
70009	270.65		2012-09-10	3001		5005

Practice Online


Inventory database model

Query Visualization:

Duration:

Query visualization of Display all the orders for the salesman who belongs to the city London - Duration

Rows:

Query visualization of Display all the orders for the salesman who belongs to the city London - Rows

Cost:

Query visualization of Display all the orders for the salesman who belongs to the city London - Cost

Contribute your code and comments through Disqus.

Previous: Write a query to display all the orders from the orders table issued by the salesman 'Paul Adam'.
Next: Write a query to find all the orders issued against the salesman who works for customer whose id is 3007.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming