Q&A for professionals, academics, and students working within the systems development life cycle
--question 1 select top 15 users.id, users.displayname, count(*) as postcount from users join posts on users.id=posts.owneruserid group by users.id,users.displayname order by postcount desc; --question 2 select top 10 users.id, users.displayname, count(posts.id) as postcount, count(comments.id) as commentcount, count(posts.id) + count(comments.id) as totalactivity from users join posts on users.id = posts.owneruserid join comments on comments.id = comments.userid group by users.id,users.displayname order by totalactivity desc; --question 4 select (count(*) * 100.0 / (select count(*) from posts)) as percentnocomments from posts where id not in ( select postid from comments )