Sort Postgres Tables

Share this video with your friends

Send Tweet

How do I see a list of my Facebook friends sorted by the number of friends they have, and then sorted alphabetically to break ties? Sorting data helps us to answer important business questions. In this lesson, we’ll learn how to do it in Postgres.

eggheadjs
eggheadjs
~ 8 years ago

Hi, I found here has a typo:

SELECT *
SELECT friends
ORDER BY friend_count desc, name desc;

SELECT *
SELECT friends
ORDER BY friend_count, name desc;

the SELECT friends should be FROM friends.