Re: does a table always need a PK?

From: Mikito Harakiri <mikharakiri_at_ywho.com>
Date: Wed, 3 Sep 2003 10:44:50 -0700
Message-ID: <IUp5b.18$eu1.185_at_news.oracle.com>


"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) Received on Wed Sep 03 2003 - 19:44:50 CEST

Original text of this message