SQL Exercises: Find the highest grade for each of the cities of the customers
SQL Aggregate Functions: Exercise-8 with Solution
Write a SQL statement which selects the highest grade for each of the cities of the customers.
Sample table: customer
SELECT city,MAX(grade) FROM customer GROUP BY city;
Output of the Query:
city max London 300 Paris 300 New York 200 California 200 Berlin 100 Moscow 200
Pictorial presentation :
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a SQL statement to know the maximum purchase amount of all the orders.
Next: Write a SQL statement to find the highest purchase amount ordered by the each customer with their ID and highest purchase amount.
What is the difficulty level of this exercise?