PostgreSQL CASE statements make it possible to add conditional logic directly into SQL queries, working similarly to IF ELSE ...
Two questions. I'm having trouble getting postgres to use an index when doing an ORDER BY UPPER(surname), for instance. I can create an index on UPPER(surname), but it doesn't use it in the query - is ...