programming-examples/sql/View/12. Write a query to create a view that shows each salesman with more than one customers.sql

8 lines
256 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*12. Write a query to create a view that shows each salesman with more than one customers.*/
CREATE VIEW mcustomer
AS SELECT *
FROM salesman a
WHERE 1 <
(SELECT COUNT(*)
FROM customer b
WHERE a.salesman_id = b.salesman_id);