From: Steve Crawford <scrawford@pinpointresearch.com>
To: bilal ghayyad <bilmar_gh@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: LIMIT 1; The Integer part only
Date: Thu, 03 Sep 2009 18:02:30 -0700
Message-ID: <4AA06726.6070107@pinpointresearch.com> (raw)
In-Reply-To: <26617.92501.qm@web53910.mail.re2.yahoo.com>
References: <26617.92501.qm@web53910.mail.re2.yahoo.com>
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?
>
Limit return to 1 record (or other specified number). Note that without
ORDER BY, there is no guarantee of which record will show up at the top
of the list. See also OFFSET. I.e. to skip the first 30 records and only
return the next 10 (records 31-40) in your list:
SELECT * from foo order by bar LIMIT 10 OFFSET 30;
> 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?
>
> For example, I have 3.900 and I need only the 3 (the integer part), which math function to be used?
>
floor(3.900)
Cheers,
Steve
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: scrawford@pinpointresearch.com, bilmar_gh@yahoo.com
Subject: Re: LIMIT 1; The Integer part only
In-Reply-To: <4AA06726.6070107@pinpointresearch.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