Say I have a simple table in postgres as the following:
+--------+--------+----------+ | Car | Pet | Name | +--------+--------+----------+ | BMW |
SQL Fiddle
SELECT distinct unnest(array['car', 'pet', 'name']) AS col, unnest(array[car, pet, name]) AS vals FROM t order by col