Skip to content
Advertisement

Oracle SQL query partially including the desired results

My requirement is to display country name, total number of invoices and their average amount. Moreover, I need to return only those countries where the average invoice amount is greater than the average invoice amount of all invoices.

Query for Oracle Database

Result: Austria 1 9500

Expected: Austria 2 4825

Schema

Country

City

Customer

Invoice

Advertisement

Answer

With no sample data, we can’t really tell whether this:

Expected: Austria 2 4825

is true or not.


Anyway: would changing the GROUP BY clause to

(i.e. removing additional two columns from it) do any good?

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement