您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

demo-queries-from slides-4.sql 600B

123456789101112131415161718
  1. SELECT vendor_id, COUNT(*) AS invoice_qty
  2. FROM invoices
  3. GROUP BY vendor_id;
  4. SELECT vendor_state, vendor_city, COUNT(*) AS invoice_qty,
  5. ROUND(AVG(invoice_total), 2) AS invoice_avg
  6. FROM invoices JOIN vendors
  7. ON invoices.vendor_id = vendors.vendor_id
  8. GROUP BY vendor_state, vendor_city
  9. ORDER BY vendor_state, vendor_city;
  10. SELECT vendor_state, vendor_city, COUNT(*) AS invoice_qty,
  11. ROUND(AVG(invoice_total), 2) AS invoice_avg
  12. FROM invoices JOIN vendors
  13. ON invoices.vendor_id = vendors.vendor_id
  14. GROUP BY vendor_state, vendor_city
  15. HAVING COUNT(*) >= 2
  16. ORDER BY vendor_state, vendor_city;