pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christophe Pettus <xof@thebuild.com>
To: bilal ghayyad <bilmar_gh@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: LIMIT 1; The Integer part only
Date: Thu, 3 Sep 2009 18:28:16 -0700
Message-ID: <B26ED7F3-10B2-4F36-B2F2-DC8ECB802A8A@thebuild.com> (raw)
In-Reply-To: <26617.92501.qm@web53910.mail.re2.yahoo.com>
References: <26617.92501.qm@web53910.mail.re2.yahoo.com>


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@thebuild.com




view thread (3+ messages)

Message-ID: <B26ED7F3-10B2-4F36-B2F2-DC8ECB802A8A@thebuild.com>
Permalink:  ../B26ED7F3-10B2-4F36-B2F2-DC8ECB802A8A@thebuild.com/
Also on:    postgresql.org/message-id/B26ED7F3-10B2-4F36-B2F2-DC8ECB802A8A@thebuild.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: xof@thebuild.com, bilmar_gh@yahoo.com
  Subject: Re: LIMIT 1; The Integer part only
  In-Reply-To: <B26ED7F3-10B2-4F36-B2F2-DC8ECB802A8A@thebuild.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox