Re: Male/female

From: "Leif B(dot) Kristensen" <leif(at)solumslekt(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Male/female
Date: 2006-12-08 15:40:45
Message-ID: 200612081640.45226.leif@solumslekt.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 8. December 2006 16:23, Raymond O'Donnell wrote:
>Just wondering.....how do list member represent gender when storing
>details of people in a database?
>
>I've done it two ways:
>
>* A bool column, with the understanding that true/false represents
>one gender or the other.
>
>* Create a domain, something like:
>CREATE DOMAIN gender_domain
> AS character varying(7)
> NOT NULL
> CONSTRAINT gender_domain_check CHECK ((((VALUE)::text =
>'male'::text) OR ((VALUE)::text = 'Female'::text)))
>
>I personally prefer the second, as it's self-documenting...is there
>any other/better way of doing it?

There's actually an ISO standard (ISO 5218) for representing gender with
numeric values: 0 = Unknown, 1 = Male, 2 = Female, 9 = not specified
(or N/A).
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE

In response to

  • Male/female at 2006-12-08 15:23:11 from Raymond O'Donnell

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Wampler 2006-12-08 15:43:46 Re: Male/female
Previous Message Tom Lane 2006-12-08 15:39:03 Re: How to use outer join in update