postgresql distinct on and order by code example Example: postgresql distinct SELECT DISTINCT bcolor FROM distinct_demo ORDER BY bcolor;