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/5. Write a query to create ...

7 lines
337 B
SQL

/*5. Write a query to create a view to keeping track the number of customers ordering, number of salesmen attached, average
amount of orders and the total amount of orders in a day.*/
CREATE VIEW totalforday
AS SELECT ord_date, COUNT(DISTINCT customer_id),
AVG(purch_amt), SUM(purch_amt)
FROM orders
GROUP BY ord_date;