USE ap;

-- 1. calculate an aggregated function on all records in the invoices table 


-- 2. USE the DISTINCT keyword in an SQL statement


-- 3. calculate an aggregated function on subset of the records 
--     in the invoices table 


-- 4. calculate an aggregated function on groups of records 
-- SELECT field_list needs to contain the group by field_list 


-- 5. identify the invoices that are above the average payment total and return 
-- the amont they are above the average payment

USE ex;


-- 6. Create a table of the paid_invoices where payment_total > average payment

-- 7. Use the HAVING clause to limit tuples in your aggregated results
-- hint: HAVING allows you to create a filter for the aggregated data
use ap; 

-- 8. How many invoices were placed from each state?


-- 9 List vendor name, vendor id where their invoice totals are greater 1000

-- 10. Sum the total paymentS and credits for account # 400
-- 11. How many times was each product ordered?
-- 12. Which vendors have 3 or more invoices?
-- 13. Which line items have a total sales volume of more than $1,000,
-- 14. List the OrderDates where the line items ordered is at east 2.
-- 15. What vendors have not submitted invoices ?
-- 16. Select invoices for vendors from California.
-- 17. List vendor_name and vendor_id that have at least one
--         invoice that uses terms_id = 1. 

