Hacker news top users - why do we have to use sum?

Hi all!

In this following project, section 3:
link

We’re asked to create a list of the users in hacker news website with more than 200 points (so that we can see the 90-9-1 rule in action).

The proposed solution was:

SELECT user, SUM(score)
FROM hacker_news
GROUP BY user
HAVING SUM(score) > 200
ORDER BY 2 DESC;

With that, I think there might be more simple/elegant solution where we let sql sum up each user’s score by filtering by user & score:

select user, score from hacker_news where score > 200 order by 2 desc;

Am I correct or am I missing a key point?
Both options yield the same output.

Thanks!

Hello @jordancarmel ,

Yes, in this case, both options yielded the same result. There are no additional records for those users.

If there were additional rows for users adding up to more than 200, the second SELECT clause would miss those records.

Data example:

User          Score
-----        ------
vxNsr         100
vxNsr         150
2 Likes