programming-examples/sql/Joins/Write a SQL statement to make a cartesian product between salesman and customer i.e. each salesman will appear for all customer and vice versa for those salesmen who must belong a city.sql
2019-11-18 14:05:53 +01:00

9 lines
413 B
SQL

/*Write a SQL statement to make a cartesian product between salesman and customer i.e. each salesman will appear for all
customer and vice versa for those salesmen who must belong a city which is not the same as his customer and the customers
should have an own grade.*/
SELECT *
FROM salesman a
CROSS JOIN customer b
WHERE a.city IS NOT NULL
AND b.grade IS NOT NULL
AND a.city<>b.city;