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.
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; |