From the following tables, create a view to find the salesperson who handles a customer who makes the highest order of a day
- برمجة سي كيو ال sql
- 2021-09-02
- mhanasmh00489829403
الأجوبة
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);
output:
sqlpractice=# SELECT * sqlpractice-# FROM elitsalesman; ord_date | salesman_id | name ------------+-------------+-------------- 2012-08-17 | 5003 | Lauson Hense 2012-07-27 | 5001 | James Hoog 2012-09-10 | 5001 | James Hoog 2012-10-10 | 5003 | Lauson Hense 2012-06-27 | 5002 | Nail Knite 2012-04-25 | 5001 | James Hoog 2012-10-05 | 5002 | Nail Knite 2012-09-22 | 5006 | Mc Lyon (8 rows)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال