| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: distinct subset query
Aloha Kakuikanu wrote:
> Given a relation of sets (in 1NF), return all the distinct sets.
>
> For example, given
>
> {a},{a,b},{a,b}
>
> encoded as
>
> set# element
> ---- -------
> 1 a
> 1 b
> 2 a
> 2 b
> 3 a
>
> The expected return is
>
> min
> set# element
> ---- -------
> 1 a
> 1 b
> 3 a
>
> Is it a well known query, and how to express it in SQL?
I would solve it in 3 steps:
set1# set2#
----- -----
1 1
1 2
2 1
2 2
3 3
is an equivalence relation.
2. Select node(s) such that there is no node with smaller label reachable from it.
3. Join this relation with the initial set relation. Received on Fri Jul 14 2006 - 16:45:16 CDT
![]() |
![]() |