- Write a SQL statement to find the total purchase amount of all orders.
SELECT SUM(purch_amt) FROM orders;
- Write a SQL statement to find the average purchase amount of all orders.
SELECT AVG(purch_amt) FROM orders;
- Write a SQL statement to find the number of salesmen currently listing for all of their customers.
SELECT COUNT (DISTINCT salesman_id) FROM orders;
- Write a SQL statement know how many customer have listed their names.
SELECT COUNT (DISTINCT cust_name) FROM consumer;
- Write a SQL statement find the number of customers who gets at least a gradation for his/her performance.
- 标准答案在count里使用了all,没发现它的作用是什么
SELECT COUNT (grade) FROM customer; ------ 标准答案 SELECT COUNT (ALL grade) FROM customer;
- Write a SQL statement to get the maximum purchase amount of all the orders.
SELECT MAX(purch_amt) FROM customer;
- Write a SQL statement to get the minimum purchase amount of all the orders.
SELECT MIN(purch_amt) FROM customer;
- Write a SQL statement which selects the highest grade for each of the cities of the customers.
SELECT city, MAX(