Re: Examples of SQL anomalies?
Date: Wed, 2 Jul 2008 16:59:19 -0400
"Ed Prochak" <edprochak_at_gmail.com> wrote in message
> On Jun 30, 5:54 pm, Marshall <marshall.spi..._at_gmail.com> wrote:
>> On Jun 30, 10:31 am, "Brian Selzer" <br..._at_selzer-software.com> wrote:
>> > Well, the OP wanted examples of SQL anomalies, and you've just
>> > confirmed a
>> > big one.
>> > If you have a bag that can contain peaches, but doesn't, then the
>> > answer to
>> > the question "How many peaches are in the bag?" is clearly zero. If
>> > you are
>> > asked by the accountant, "How much were we billed by AT&T this month?"
>> > but
>> > AT&T didn't send a bill, then the answer is clearly zero. That SQL's
>> > COUNT
>> > and SUM are something other than these common sense usages exemplifies
>> > their
>> > anomalous nature.
>> [I meant to say this in my other post, but]
>> Brian gets it exactly right here.
> I'm not so sure about the AT&T bill. Consider the question may be
> badly phrased:
> "How much were we billed by AT&T this month?"
> Is the amount being sought the amount on the bill received this month?
> or the amount for this month's services?
Obviously, it is the sum of the amounts on all bills received from AT&T this month (excluding any duplicate bills, of course). The question is not "How much were we billed by AT&T /for/ this month?" But rather, "How much were be billed by AT&T this month?"
> If the question is asked July 1 and we haven't got the bill in the
> mail yet, the answer must be "I don't know."
No, the answer is still zero because the closed world assumption requires: "if we don't know, then it ain't so."
> And who is the "we"? Are there multiple entities involved? (multiple
> businesses owned by one parent company with separate phone accounts/
> bills? or maybe a home business and personal home phone account both
> shown on one bill?)
"We" is obviously "the company we both work for (or with, if the company is the accountant's client)," for if the subject were to include more than one business, then the use of "we" would not be precise enough to obtain a valid response.
> So even in real life NULL (aka "I don't know") happens to be the
> correct answer to some questions. It is not as clean cut as you and
> Brian would like.
Your use of "aka" here is inappropriate because NULL can be known sometimes as "I don't know" or sometimes as "Maybe so" or sometimes even as "Does not apply." And "I don't know" may indeed be the correct answer to some questions, but not to those posed above. Received on Wed Jul 02 2008 - 15:59:19 CDT