Question: Write a SQL SELECT query that will return the vendorID, invoiceNumber, and invoiceTotal from the invoices table where the invoiceTotal is less than the average

Write a SQL SELECT query that will return the vendorID, invoiceNumber, and invoiceTotal from the invoices table where the invoiceTotalis less than the averageinvoiceTotal for that vendorID.Order by vendorID and then invoiceTotal.

This is a correlated subquery and a very similar example is found in chapter six.These are like self-joins in that a table aliased in the main query is used in the subquery.Be sure to understand the solution as opposed simply to copying it!There will be one or more of these on test two. (My solution has 36 rows.)

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 Mathematics Questions!