SQL Welp Project - Analyzing Data

Hi guys,
I have a question about the project ‘Welp’ from Analyze Data with SQL. Specifically, I am concerned with task 9.

The assignment is: ‘Companies want to be on the lookout for …um… difficult reviewers. Write a query that finds the reviewer with the most ratings that are BELOW the average rating for places.’

For this I wrote the following query and nothing is put out to me.

SELECT COUNT(places.average_rating), reviews.username
FROM reviews
LEFT JOIN places
ON reviews.id = places.id
WHERE places.average_rating < AVG(places.average_rating)
ORDER BY places.average_rating DESC
GROUP BY reviews.username
LIMIT 10;

This is the task:
Since the hint is also relatively little, I can’t manage to find the solution.
Can you help me?

I think this is the answer. I had trouble understanding the request. Without a way to check, no way to know if this is the intended output.

SELECT COUNT(*)
,username
FROM reviews
JOIN places
ON places.id = reviews.place_id
WHERE reviews.rating < places.average_rating
GROUP BY username
ORDER BY 1 DESC
LIMIT 1;

the result is @pinkdeb with 7 reviews

Task 8:
A simple answer

WITH twenties AS ( SELECT * FROM reviews WHERE strftime("%Y", review_date) = '2020' ) SELECT * FROM twenties LEFT JOIN places ON twenties.place_id = places.id ;
1 Like