Is a nested count possible in SQL?

Hello,

Question 2 on the “Hacker News” project says: Recent studies have found that online forums tend to be dominated by a small percentage of their users (1-9-90 Rule). Is this true of Hacker News? Is a small percentage of Hacker News submitters taking the majority of the points? First, find the total score of all the stories etc.

I did that and it was all fine - but it struck me the exercise they asked us to do didn’t follow the preamble to the question. The exercise took popularity (points) as the key metric, whereas the preamble to the question was talking about the volume of titles/contributions. So I set about trying to find:
a) How many users were responsible for contributing articles, as a % of total users.
b) How many users were “super contributors” - had contributed more than one article.

I got myself this far (see screenshot), but I don’t know how to count up the number of “super contributor” users I’ve identified from here. Could someone point me in the right direction, please?

Thank you.

Question link:

https://www.codecademy.com/paths/data-science/tracks/sql-intermediate/modules/dspath-sql-aggregates-projects-and-applications/projects/sql-hackernews

Query I put in:

SELECT user, COUNT(title) AS ‘# of Contributions’
FROM hacker_news
GROUP by user
HAVING COUNT(title)>1
ORDER by 2 DESC;

1 Like

I think a sub-query or CTE would be the way to go. If they’ve not been introduced then those are the terms you’d probably want to hunt down.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.