• Home
  • Blog
  • 3 sql queries with relational database

3 sql queries with relational database

0 comments

There are 3 queries I need to learn how to write in SQL

1-)For each user, find the percentage of users that have fewer posts than them. Sort the results from high percentage to low, and limit the output to the 30 users with the highest post count.
2-)For each user, find the percentage of users that have spent less time on the site than them. Omit users whose first month was the last month in the data. Sort the results from high percentage to low, and limit the output to the 30 users with the highest post count.
3-)For each user, find the percentile they’re in for time on site. We’ll define percentile as the percentage of users who spent as much or less time on the site than the given user.

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}