programming-examples/sql/Subqueries/8. Write a query to counts the customers with grades above New York's average.sql
2019-11-18 14:05:53 +01:00

7 lines
177 B
SQL

SELECT grade, COUNT (DISTINCT customer_id)
FROM customer
GROUP BY grade
HAVING grade >
(SELECT AVG(grade)
FROM customer
WHERE city = 'New York');