You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
474 B
SQL
11 lines
474 B
SQL
/*18. Write a query that extract the rows of all salesmen who have customers with more than one orders.*/
|
|
SELECT *
|
|
FROM salesman a
|
|
WHERE EXISTS
|
|
(SELECT * FROM customer b
|
|
WHERE a.salesman_id=b.salesman_id
|
|
AND 1<
|
|
(SELECT COUNT (*)
|
|
FROM orders
|
|
WHERE orders.customer_id =
|
|
b.customer_id)); |