• David Portas (11/18/2009)


    GSquared (11/18/2009)


    Interesting problem, but easily solved by adding a foreign key constraint to the Orders table, referencing the OrdersItems table (a join table between Orders and Items).

    Then how would you insert a new Order or populate the OrderItems table?

    Null does not (accurately) represent the property of being unknown. That's just your assumption or convention, not anything actual or implied by standard SQL. That is demonstrable by the straightforward fact that x = x is True in mathematics and reality if x is unknown but is NOT true in SQL.

    If you are seriously going to use quantum mechanics as a criteria for the design of database systems then I have nothing much more to say! If you are really going to be that silly then you would have to disallow ALL deterministic results of any kind from the database wouldn't you? No, don't bother to answer that... :crying:

    I didn't say null equals nothing. What I meant was that SQL wrongly returns a null as the sum of an empty set, instead of the mathematical and real world answer of zero.

    Null is exactly defined as being an unknown value.

    <programming> A special value used in several languages to represent the thing referred to by an uninitialised pointer.

    <database> A special value that may be stored in some database columns to represent an unknown, missing, not applicable, or undefined value. Nulls are treated completely differently from ordinary values when evaluating SQL expressions and there are several SQL constructs for dealing with nulls.

    Reference: Free Online Dictionary of Computing

    Check ANY reference on SQL and you'll find this is far from some assumption I came up with on my own. It's the standard, accepted definition. Check a good dictionary.

    On the point of x=x, yes, that's mathematically true. Ask any decent mathematician if you can validly compute 5 + x without knowing what the value of x is. Most high school algebra graduates can answer that one correctly. You have the option in SQL of allowing that null = null, but unless you are comparing the same two nulls, you can't be sure.

    For example, if you have an item on an unknown order. You know that Joe is going to order a sandwich for lunch, but you don't have an order number yet for the cash register, and don't yet know what else, if anything, will be ordered, can you really assign that sandwich to EVERY order that has an unknown cash register receipt ID? If you use null = null in that real-life situation, you're going to create HUGE problems for your business. Yet, per your assertion, null = null because x = x, and you're going to add a sandwich to every order for every customer who's still in line to go to the register.

    With your empty set example, there you go again assuming that null means something other than unknown value. What's the sum of the weight of all wamingungumas in the world? Per your logic, it's zero, because the weight is currently null, because you can't possibly know what the unit weight is.

    My statement about mathematics being an abstract that any decent scientist understands isn't the real thing is not limited to quantum physics. That's an absurd statement. If you have an apple in your left hand and an apple in your right hand, you don't have to go down to the level of them being made of different energy quanta to know that they aren't truly identical. Put them on a ballance, and odds are, they won't even weigh the same amount. We're talking grams here, not electron-volts. Take a good look at them in reasonable light, and I'll bet you can, by eyeball, identify differences in shape, color, length of stem, dimensions. Bite into them, and by that crude sense known as taste, you'll probably find that one is sweeter than the other, one perhaps more tart. If you didn't get that when you took grade school science, and weren't taught that math is an artificial abstraction, then you missed out on a very, very important fundamental to all human knowledge.

    Mocking me by making asinine statements about what I wrote doesn't actually win the argument for you. It doesn't make your point. You need to actually defend the statement that a "true relational database" really solves real world situations. You haven't done so yet. Haven't even tried.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon