Re: Problem -Postgre sql

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: "Vikas J" <vikas(dot)jadhav(at)codecindia(dot)com>
Cc: postgresql sql list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Problem -Postgre sql
Date: 2005-10-19 05:41:25
Message-ID: 8FB39706-1EFC-4D9F-ADBD-1311D4B08940@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

[Please do not email me directly. Please post to the list so others
may help and benefit from the discussion.]

On Oct 19, 2005, at 14:30 , Vikas J wrote:

> IsNull in sql server has syntax like isnull(column,substitute)
> if "column" is null it shows value of "substitute". That can be
> achieved
> with CASE clause in postrgre but I want alternate function.

If you look at the doc links I provided below, you will find that
COALESCE does exactly this.

> Can you tell me how to write function like MAX() that will work
> directly on
> colmuns. I want to create my own function that will not need table
> name as
> paramter.
> it shld work similarly to max() function in postgre.

[Again, it's PostgreSQL or Postgres. It is *not* spelled "postgre".]

In my experience, the max() aggregate function does not require table
names as parameters and work on columns directly.
http://www.postgresql.org/docs/8.0/interactive/functions-aggregate.html

I suggest you take some time to look at the docs. They're quite
extensive and helpful.
http://www.postgresql.org/docs/8.0/interactive/index.html

Michael Glaesemann
grzm myrealbox com

>> I'm not quite sure what the ISNULL() function does in SQL Server, but
>> it sounds like it might be similar to either COALESCE or the IS NULL
>> expression.
>>
>> These pages might help you:
>>
>> COALESCE
>> http://www.postgresql.org/docs/8.0/interactive/functions-
>> conditional.html#AEN12056
>>
>> IS NULL
>> http://www.postgresql.org/docs/8.0/interactive/functions-
>> comparison.html

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Matthew Peter 2005-10-19 05:54:23 Re: problems with array
Previous Message Eugene E. 2005-10-19 05:41:08 Re: query to file