Re: LIMIT 1; The Integer part only

From: Christophe Pettus <xof(at)thebuild(dot)com>
To: bilal ghayyad <bilmar_gh(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: LIMIT 1; The Integer part only
Date: 2009-09-04 01:28:16
Message-ID: B26ED7F3-10B2-4F36-B2F2-DC8ECB802A8A@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Sep 3, 2009, at 5:49 PM, bilal ghayyad wrote:
> 1) When writing the function (I mean sql function) in the
> postgresql, I noticed the use for LIMIT 1, but did not understand
> what does it mean and why we use it?

It restricts the number of rows returned by the SELECT. You can find
the documentation here:

http://www.postgresql.org/docs/8.4/interactive/sql-select.html#SQL-LIMIT

>
> 2) Also in the function (the sql function) in the postgresql, if I
> need to take the integer part of the number, which math function can
> do this for me?

floor or trunc, depending on the behavior you want for negative numbers:

http://www.postgresql.org/docs/8.4/interactive/functions-math.html

--
-- Christophe Pettus
xof(at)thebuild(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Simon Bateman 2009-09-04 05:36:10 Adding ENUM Type
Previous Message Steve Crawford 2009-09-04 01:02:30 Re: LIMIT 1; The Integer part only