Re: Inserting boolean types as an alias?

Поиск
Список
Период
Сортировка
Искать
От
John R Pierce
Тема
Re: Inserting boolean types as an alias?
Дата
Msg-id
529D1ECD.2070504@hogranch.com
Ответ на
Список
Дерево обсуждения
Inserting boolean types as an alias? Nick <ngalewski@gmail.com>
Re: Inserting boolean types as an alias? Michal Politowski <mpol+pg@meep.pl>
Re: Inserting boolean types as an alias? Adrian Klaver <adrian.klaver@gmail.com>
Re: Inserting boolean types as an alias? John R Pierce <pierce@hogranch.com>
Re: Inserting boolean types as an alias? David Johnston <polobo@yahoo.com>
Re: Inserting boolean types as an alias? John R Pierce <pierce@hogranch.com>
On 12/2/2013 3:46 PM, Nick wrote:
> Hello I am new to this site and also a student. I am working on an assignment
> and was wondering if there is a way to make an alias for a boolean? For
> example when I am making a table called club_games and it must contain the
> memberID, gameID, count, and status as column fields. When I enter the data
> for status I want it to say either "unavailable" for false and "available"
> for true. but I don't know how to do that.

you could use an enum, or you could use a case statement on your query, 
like,

SELECT memberID, gameID, hardwareID, count, case when status then 'available' else 'unavailable' end FROM club_Games




-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast


В списке pgsql-general по дате отправления
От: Adrian Klaver
Дата:
От: Tom Lane
Дата:
FAQ