Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Counting propositions
"Paul" <paul_at_test.com> wrote in message
news:_SJBc.18359$NK4.3212222_at_stones.force9.net...
> x wrote:
> >> If columns a & b combined are a candidate key, we want to say
> >> something like: "select count(a,b) from R" but I don't think this
> >> is legal syntax in SQL. Maybe it should be? Are there reasons why
> >> not?
> >
> > So we really want to count just the candidate keys, not the
> > propositions ?
>
> Counting the candidate keys is equivalent to counting the propositions.
> I just think that extending the count syntax to multiple columns feels a
> neater way of generalising it. count(*) seems a bit of an anomaly
> because it kind of operates on a relation instead of the data within
> the relation.
If there is something like count(distinct *) , it count "propositions" No matter how you modify the relation, it count "propositions" If you use count(distinct a,b,c) you count distinct (a,b,c) tuples no matter how you modify the relation (if a,b,c remains unaltered).
> > Have you guessed right what is the meaning of "s(X)" in the Prolog
> > code I posted ?
>
> No, I'm having a look at it though and having to learn the syntax. I
> think I understand that square brackets indicate lists and the
> underscore is like an unbound variable. I'm guessing that R and L might
> mean right and left in this case?
[H|T] is a list with head H and tail T. H is the first element in the list
and T is the rest of the list.
R stands for "result", L stands for "list"
"_" is a "don't care" unnamed variable.
[] is the empty list.
member(X,L) is true iff X is an element of list L.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=