![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a set of predefined constants with a set of predefined relationships and am looking for a way to link them if possible to ensure data integrity. An example would be if I wanted to keep track of programs and I have a table Programs with rows operating system type and programming language. If both operating system type and programming language are foreign keys to reference tables (just tables with a primary key and a name to the element they are referencing) is there a way to ensure data integrity for possible nonsensical pairings such as programming language c# and operating system unix? Thanks in advance, Jim Howard |
#3
| |||
| |||
|
|
I have a set of predefined constants with a set of predefined relationships and am looking for a way to link them if possible to ensure data integrity. An example would be if I wanted to keep track of programs and I have a table Programs with rows operating system type and programming language. If both operating system type and programming language are foreign keys to reference tables (just tables with a primary key and a name to the element they are referencing) is there a way to ensure data integrity for possible nonsensical pairings such as programming language c# and operating system unix? Thanks in advance, Jim Howard |
#4
| |||
| |||
|
|
On Oct 3, 10:44 pm, JamesHoward <James.w.How... (AT) gmail (DOT) com> wrote: I have a set of predefined constants with a set of predefined relationships and am looking for a way to link them if possible to ensure data integrity. An example would be if I wanted to keep track of programs and I have a table Programs with rows operating system type and programming language. If both operating system type and programming language are foreign keys to reference tables (just tables with a primary key and a name to the element they are referencing) is there a way to ensure data integrity for possible nonsensical pairings such as programming language c# and operating system unix? Thanks in advance, Jim Howard Well, those non-viable pairings are part of your data. You could have an ugly hard coded check constraint, or alternatively create a table containing those disallowed pairings, and check select against it on any insertion into your programs table. I'd check out the particular flavour of RDBMS you are using on google for appropriate syntax. Good luck. |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Thanks for the answers. It sounds like the best solution between allowed pairings and disallowed pairings comes down to how much data you will have to enter. If one of those is dense in a large possible data space then it wouldn't be ideal to enter that much manual data. I think I am going to go for the disallowed pairings in this case as it is less data to enter. |
![]() |
| Thread Tools | |
| Display Modes | |
| |