Timeline for Could a null column be part of a primary key?
Current License: CC BY-SA 3.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 31, 2018 at 6:08 | vote | accept | VansFannel | ||
Feb 14, 2017 at 10:57 | answer | added | kevin | timeline score: 0 | |
Sep 20, 2015 at 11:54 | comment | added | Walter Mitty | If NULL really means "no data here", then what is the answer when we ask "are these two keys different"? Well, if all the values are filled in, it's easy. If all the values are the same, then the keys are the same. If one or more of the values is different, then the keys are different. If one of the keys contains a missing value, the answer could be "maybe". This is where things start to fall apart. | |
Sep 20, 2015 at 11:51 | comment | added | Walter Mitty | In part, it depends on what NULL means. NULL means different things to different people. I believe the real meaning is "no data here". Whether that means "not applicable", "not available", or as in this case "no relationship" is in the eye of the beholder. | |
Sep 20, 2015 at 11:46 | comment | added | Walter Mitty | Oversimplifying the relational model usually does more harm than good. Having said that, I'll throw in my two cents. First off, I would say "damage" rather than "destroy". Second, Ed Codd is quite explicit about what harm is done by systems that are "almost relational". I don't always believe everything he wrote, but he has more crdibility than I do, by far. | |
Sep 19, 2015 at 22:11 | comment | added | usr | @WalterMitty I never understood why having a null value in a PK would destroy the value that an RDBMS brings. I have heard it many times. Can you elaborate? | |
Sep 18, 2015 at 10:33 | comment | added | Walter Mitty | Conceptually, the DBMS engineers couldn't have permitted NULLs in primary keys without going against the entire relational data model. And the relational model is part of what makes relational databases so useful. You may or may not be interested in this aspect, but it's important to point out for future visitors. | |
Sep 18, 2015 at 9:26 | history | tweeted | twitter.com/#!/StackDBAs/status/644804799653933056 | ||
Sep 18, 2015 at 8:41 | history | edited | Mark Sinkinson | CC BY-SA 3.0 |
edited title
|
Sep 18, 2015 at 8:39 | answer | added | ypercubeᵀᴹ | timeline score: 32 | |
Sep 18, 2015 at 8:32 | history | edited | VansFannel | CC BY-SA 3.0 |
added 10 characters in body
|
Sep 18, 2015 at 8:31 | comment | added | VansFannel | @ypercube Could you please add the complete sql sentence as answer? I don't work very often with sql and I don't know how to do it. Thanks. | |
Sep 18, 2015 at 8:30 | history | edited | ypercubeᵀᴹ |
edited tags
|
|
Sep 18, 2015 at 8:22 | history | edited | VansFannel | CC BY-SA 3.0 |
added 84 characters in body
|
Sep 18, 2015 at 8:21 | comment | added | VansFannel |
Yes, I want to prevent that two or more codes reference the same HelperCode. Another option is to set HelperCodeId column as Unique.
|
|
Sep 18, 2015 at 8:17 | comment | added | Andriy M |
Why would you want HelperCodeId to be part of the PK? Is it, by any chance, because you want to prevent two or more Codes to reference the same HelperCode?
|
|
Sep 18, 2015 at 7:56 | history | asked | VansFannel | CC BY-SA 3.0 |