I got asked this: having this table: # select * from a order by d; t | d ---+---- O | 1 O | 2 O | 3 M | 4 M | 5 M ...

Let's assume you have very simple table with users: # \d users Table "public.users" ...