| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Demo: Db For Dummies
> > Above type queries can only be resolved via code/API at this time.
> > The psuedo code below solves similar but simpler case: <<
>
> Why would I want to write proceudral code for this things?
For a problem that fits within RM's scope, one probably wouldn't want to. The code demonstrates how to perform the query with the tools currently available with XDb2.
> > Person with uniqie hair color?
>
> SELECT hair_color, MAX(person_id)
> FROM Population
> GROUP BY hair_color
> HAVING COUNT (*) = 1;
First show the script to model the things as XDb2 did, that is without
NULLs and redundancy (I won't ask you to normalize down to symbols as
it would make RM's solution impractical).
Then add some carpets with hair properties as shown below. XDb2's prior solutions will work with a minor change, which is to drop "& %.cls=person" clause from the inner loop. In fact XDb2's solution will then work even if we add dogs, cats, etc. I believe when we compare XDb2 and RM's solutions under more complex situations, one will begin to see the point.
CREATE2 *carpet.cls = thing;
CREATE2 *carpet1.cls = carpet;
CREATE2 carpet1.hair = (%.cls=hair & %.color=red & %.color=blue);
CREATE2 *carpet2.cls = carpet;
CREATE2 carpet1.hair = (%.cls=hair & %.color=red & %.texture=silky &
%.texture=smooth);
Received on Sun Nov 14 2004 - 16:59:05 CST
![]() |
![]() |