Collapsing a column to yes/no on query
Here are three simple methods to do it,


Returning bool: Just use a simple CASE statement.

SELECT name, CASE WHEN value = 'foo' THEN true ELSE false END
FROM table;

Returning bool compact: You can actually make it more terse, so long as value is NOT NULL. That CASE statement is essentially equal to

SELECT name, value = 'foo'
FROM table;


If value is ever null though you'll get null rather than false.
Returning text: If you insist on yes and no instead (I wouldn't do that), you can use strings instead of the special-made boolean type (there is no more compact syntax to write this).

SELECT name, CASE WHEN value = 'foo' THEN 'yes' ELSE 'no' END
FROM table;