Re: does a table always need a PK?
From: Christopher Browne <cbbrowne_at_acm.org>
Date: 3 Sep 2003 19:52:52 GMT
Message-ID: <bj5gqk$fkobb$1_at_ID-125932.news.uni-berlin.de>
> to
> would
> MEDIAN is redundant:
> select sal from (
> select rownum rn, sal from (
> select sal from emp order by sal
> )
> ), (select max(rownum) rowcount from emp)
> where rn = (rowcount+1)/2
> union
> select sum(sal)/2 from (
> select rownum rn, sal from (
> select sal from emp order by sal
> )
> ), (select max(rownum) rowcount from emp)
> where mod(rowcount,2)=0 and (rn = rowcount/2 or rn = rowcount/2 + 1)
Date: 3 Sep 2003 19:52:52 GMT
Message-ID: <bj5gqk$fkobb$1_at_ID-125932.news.uni-berlin.de>
Martha Stewart called it a Good Thing when"Mikito Harakiri" <mikharakiri_at_ywho.com>wrote:
> "Bob Badour" <bbadour_at_golden.net> wrote in message
> news:FTp5b.429$aY3.44396671_at_mantis.golden.net...
>> "Mikito Harakiri" <mikharakiri_at_ywho.com> wrote in message >> news:PLo5b.12$eu1.111_at_news.oracle.com... >> > >> > "Christopher Browne" <cbbrowne_at_acm.org> wrote in message >> > news:bj3q4j$eaohu$2_at_ID-125932.news.uni-berlin.de... >> > > I don't see reason to consider it mandatory to apply reduction inside >> > > the SQL expression for much the same reason that Common Lisp doesn't >> > > assume that all expressions involve REDUCE. >> > >> > But Lisp is not a gospel. At least in the database world. >> > >> > If a complex multiargument function can be reduced to dyadic, that's a >> very >> > nice math property. It maybe worth keeping it at all cost, while trying
> to
>> > investigate what else maybe a problem. >> >> MEDIAN would represent such a problem. Actually, any ordered partition
> would
>> represent such a problem. >
> MEDIAN is redundant:
>
> select sal from (
> select rownum rn, sal from (
> select sal from emp order by sal
> )
> ), (select max(rownum) rowcount from emp)
> where rn = (rowcount+1)/2
> union
> select sum(sal)/2 from (
> select rownum rn, sal from (
> select sal from emp order by sal
> )
> ), (select max(rownum) rowcount from emp)
> where mod(rowcount,2)=0 and (rn = rowcount/2 or rn = rowcount/2 + 1)
What is "rownum?"
I am quite sure that's not standard SQL.
-- (reverse (concatenate 'string "ac.notelrac.teneerf" "_at_" "454aa")) http://www.ntlug.org/~cbbrowne/spreadsheets.html I am not a Church numeral! I am a free variable!Received on Wed Sep 03 2003 - 21:52:52 CEST