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

SQL Consider the query shown SELECT vendor_state, vendor_city COUNT) AS invoice_qty ROUND(AVG(invoice_total),2)

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!