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.
programming-examples/sql/View/7. Write a query to create ...

9 lines
376 B
SQL

/*7. Write a query to create a view that finds the salesman who has the customer with the highest order of a day. */
CREATE VIEW elitsalesman
AS SELECT b.ord_date, a.salesman_id, a.name
FROM salesman a, orders b
WHERE a.salesman_id = b.salesman_id
AND b.purch_amt =
(SELECT MAX (purch_amt)
FROM orders c
WHERE c.ord_date = b.ord_date);