Inserting boolean types as an alias?

From: Nick <ngalewski(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Inserting boolean types as an alias?
Date: 2013-12-02 23:46:17
Message-ID: 1386027977319-5781328.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.
This is what I have currently for the line that I am specifically talking
about:

INSERT INTO club_Games(memberID, gameID, hardwareID, count, status)
VALUES ((SELECT memberID FROM members WHERE name = 'Fred Flinstone'),
(SELECT gameID FROM games WHERE name = 'Jurrasic Park'), NULL, 1, 'true');

when I do the SELECT * FROM club_Games this is my output:

id gameid memberid hardwareid count
status
1 12345zzzzz A12345 <null> 1
t

Where it says t for status I wanted it to say available but mean true for
boolean, but I don't know how to do that. Thanks to all for help.

My file is attached if you would like to view my assignment. task5.txt
<http://postgresql.1045698.n5.nabble.com/file/n5781328/task5.txt>

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Inserting-boolean-types-as-an-alias-tp5781328.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2013-12-02 23:50:57 Does "--no-unlogged-table-data" prevent table locking?
Previous Message Jeff Janes 2013-12-02 23:23:15 Re: query creates a huge toast tables