Re: replace NULL

From: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
To: "Kancha (dot)" <kancha2np(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: replace NULL
Date: 2002-04-09 12:14:49
Message-ID: 200204091414.49688.andreak@officenet.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tuesday 09 April 2002 14:00, Kancha . wrote:
> Hello
>
> i want to run a select query on a table. eg:
>
> select age from people;
>
> if age is NULL then I want to replace it by some text,
> say "SHY" so the output is like
>
> name age
> me 10
> jane SHY
> jack 32
>
> how do i make this replacement of null value to some text
>

select name, COALESCE(age, 'SHY') from people;

--
Andreas Joseph Krogh (Senior Software Developer) <andreak(at)officenet(dot)no>
A hen is an egg's way of making another egg.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-04-09 13:01:16 Re: Hierarchical Queries
Previous Message Kancha . 2002-04-09 12:00:03 replace NULL