Re: Relation subset operators
Date: Fri, 05 Jun 2009 19:50:59 GMT
> On 5 juin, 20:32, paul c <toledobythe..._at_oohay.ac> wrote:
>> cim..._at_hotmail.com wrote: >>> On 5 juin, 18:56, paul c <toledobythe..._at_oohay.ac> wrote: >>>> cim..._at_hotmail.com wrote: >> ... >>> Question 8 (the one you mentionned): What are the total sales of >>> salesmen who sold ALL purple cars is a particular case of Question1 >>> since all salesmen who sold ALL purple cars are the same than ALL >>> salesmen who have sold AT LEAST one purple car. ... >> I believe, au contraire, that the answer is the same as the total sales >> of each salesman (assuming there never were any purple cars, which would >> be a shame IMO). See "purple parts" in >> >> http://www.dbdebunk.com/page/page/772076.htm
> For the moment, let's keep aggregating out of the equation. First, I
> want to make sure I understand correctly Question 8. The debunk link
> provided does not explain under what conditions a salesman, who'd be a
> part of a set of salesmen who have sold ALL purple cars, would NOT
> also be a salesman who sold AT LEAST one purple car. I would
> appreciate if you could give me one example clarifying the previous
> question ?
It's to do with logical FORALL. If the set of purple cars is empty, then no salesman could sell any purple cars (not even one) so all salesman have sold all of them! (wish I could phrase that en francais.)
(I have seen people who are more patient than I express this is in SQL by negating "NOT EXISTS".)
This query may not seem useful to many people, but if so I'd ask what would they like to happen if suddently there were purple cars? Not suggesting a language should be a slave to logic, however, if all the logical rules aren't followed, then proving a result, comparing two equal results from different queries (very useful for regression and other testing), not to mention optimization all become hit-or-miss problems.
As far as I know, nobody, not even the originators, has ever tried to formalize SQL 'logic'. I wonder why? Received on Fri Jun 05 2009 - 21:50:59 CEST