in reply to Re: They do respect set theory! (and violate 3NF)
in thread (OT) Why SQL Sucks (with a little Perl to fix it)
Ovid this reasoning is flawed. The table with an identity column violates normalization no more than the original table did. All it does is give you a basis to understand the previous results. The DB at some level maintains those values anyway, all that adding the column does is make them explicit and available for reference. Redo your original queries to show the ID's and youll see the dupes in your output are due to dupes in your input.
Incidentally adding the id doesnt violate normalization. What violates normalization is the two dupe rows in the table (by definition, any table that contains duplicate data in two columns across multiple rows is not fully normalized). Adding the identity column doesnt change that fact: Your claim that this means you cannot maintain data integrity is rubbish. On the contrary identity columns make it easier to maintain data integrity. Instead of useing "City/Country" as the key to the table, you use the ID as the key, and then put a unique index on City/Country, now your city/country data is guaranteed to be a set and the id's allow non ambiguous reference to a particular location object in the table.
Assuming these truly represent the same city, are we referring to 01 or 02?
You have no way of differentiating the two entries without the identity column. You have a way of differentiating the two entries with one. With the identity column references into that table are unambiguous, without the identity column references into that table are ambiguous. Without a constraint on duplicate values in the key columns in the table and without an identity column, the table cannot be unambiguously addressed for all data sets it contains. Ideally you should have both, a identity and a column level constraint prohibiting dupe values.
End result: you are still using Garbage input to prove that the RDBMS is doing something wrong. Which is just silly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: They do respect set theory! (and violate 3NF: yeah GIGO)
by Ovid (Cardinal) on Dec 12, 2005 at 19:07 UTC | |
by demerphq (Chancellor) on Dec 12, 2005 at 21:32 UTC |