Question: SQL Consider the query shown SELECT vendor_state, vendor_city COUNT) AS invoice_qty ROUND(AVG(invoice_total),2) AS invoice_avg FROM invoices JOIN vendors ON invoices.Vendor id=vendors.vendor id GROUP BY vendor_state,
SQL

Consider the query shown SELECT vendor_state, vendor_city COUNT) AS invoice_qty ROUND(AVG(invoice_total),2) AS invoice_avg FROM invoices JOIN vendors ON invoices.Vendor id=vendors.vendor id GROUP BY vendor_state, vendor_city HAVING COUNT(*) >= 2 ORDER BY vendor_state, vendor city Could the HAVING clause be replaced by a WHERE clause and still get the same result set? Yes. WHERE can be used instead of HAVING in all cases No. The WHERE clause is applied before the GROUP BY is done, and before the aggregate functions are computed Yes. WHERE can be used instead of HAVING is some cases, and it works in this case O No. The WHERE clause filters rows from a result set while the HAVING clause prevents rows from every being selected into a result set
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
