Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You're missing an ORDER BY id clause to comply with the requirement:
"Two or more posts within the category can be tied by (have the same) the number of views. Use post id as a tie breaker – a post with a lower id gets a higher rank."
Without this, ties in view count may return arbitrary posts instead of the ones with the lowest IDs.
Your current query only orders by views DESC, so if there are more than 2 posts with the same number of views, PostgreSQL will select any 2 arbitrarily, without ensuring they are the ones with the lowest ID.