top predicate
top predicate
От:
"Karen Hill" <karen_hill22@yahoo.com>
Дата:
It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here is an example: SELECT TOP 10 products from sales;
Re: top predicate
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Karen Hill" writes: > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? It's not in the SQL standard. If we were to implement something like what I think you're asking for (your example is way underspecified), it'd probably look like SQL2003's window functions. regards, tom lane
Re: top predicate
От:
Jan de Visser <jdevisser@digitalfairway.com>
Дата:
On Thursday 11 May 2006 16:34, Karen Hill wrote: > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here > is an example: > > SELECT TOP 10 products from sales; Just for my understanding: This would return the 10 products with the most matching sales rows, right? jan -- -------------------------------------------------------------- Jan de Visser jdevisser@digitalfairway.com Baruk Khazad! Khazad ai-menu! --------------------------------------------------------------
Re: top predicate
От:
"Joshua D. Drake" <jd@commandprompt.com>
Дата:
Karen Hill wrote:
> It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here
> is an example:
>
> SELECT TOP 10 products from sales;
Just use:
SELECT product from sales limit 10
OR
SELECT products from sales order by products desc limit 10;
Joshua D. Drake
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>
--
=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/
Re: top predicate
От:
Ben <bench@silentmedia.com>
Дата:
Have you tried using the LIMIT clause? select porducts from sales limit 10; http://www.postgresql.org/docs/8.1/interactive/queries-limit.html On Thu, 11 May 2006, Karen Hill wrote: > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here > is an example: > > SELECT TOP 10 products from sales; > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org >
Re: top predicate
От:
"Karen Hill" <karen_hill22@yahoo.com>
Дата:
Tom Lane wrote: > "Karen Hill" writes: > > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? > > It's not in the SQL standard. If we were to implement something like > what I think you're asking for (your example is way underspecified), > it'd probably look like SQL2003's window functions. > Hi Tom, The TOP predicate seemed to be really common in some other RDBMS. I guess it isn't in the standard since oracle seems to be missing it in 9i. Maybe 10g has it. http://www.oracle.com/technology/tech/migration/ama/exchange/docs/ss2k/SELECTStatement.htm
Re: top predicate
От:
"Karen Hill" <karen_hill22@yahoo.com>
Дата:
Jan de Visser wrote: > On Thursday 11 May 2006 16:34, Karen Hill wrote: > > It seems PostgreSQL doesn't have a TOP Predicate. Why is that? Here > > is an example: > > > > SELECT TOP 10 products from sales; > > Just for my understanding: This would return the 10 products with the most > matching sales rows, right? > > jan > > No, it would return the top 10 selling products in this example.