7 lines
317 B
SQL
7 lines
317 B
SQL
/*11. Write a query to create a view that shows the average and total orders for each salesman after his or her name.
|
|
(Assume all names are unique)*/
|
|
CREATE VIEW norders
|
|
AS SELECT name, AVG(purch_amt), SUM(purch_amt)
|
|
FROM salesman, orders
|
|
WHERE salesman.salesman_id = orders.salesman_id
|
|
GROUP BY name; |