Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id BA44C6337EC for ; Thu, 3 Sep 2009 22:28:27 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 00890-09 for ; Fri, 4 Sep 2009 01:28:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp116.dfw.emailsrvr.com (smtp116.dfw.emailsrvr.com [67.192.241.116]) by mail.postgresql.org (Postfix) with ESMTP id DA4A0633545 for ; Thu, 3 Sep 2009 22:28:19 -0300 (ADT) Received: from relay1.relay.dfw.mlsrvr.com (localhost [127.0.0.1]) by relay1.relay.dfw.mlsrvr.com (SMTP Server) with ESMTP id 04F7A1278277; Thu, 3 Sep 2009 21:28:18 -0400 (EDT) Received: by relay1.relay.dfw.mlsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 863B2127816D; Thu, 3 Sep 2009 21:28:17 -0400 (EDT) Cc: pgsql-sql@postgresql.org Message-Id: From: Christophe Pettus To: bilal ghayyad In-Reply-To: <26617.92501.qm@web53910.mail.re2.yahoo.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: LIMIT 1; The Integer part only Date: Thu, 3 Sep 2009 18:28:16 -0700 References: <26617.92501.qm@web53910.mail.re2.yahoo.com> X-Mailer: Apple Mail (2.935.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/23 X-Sequence-Number: 33088 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