Create one-to-many to two fields in different tableWhether or not to create separate tables for different...
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
How can I fix this gap between bookcases I made?
How long does it take to type this?
Why don't electron-positron collisions release infinite energy?
The use of multiple foreign keys on same column in SQL Server
Example of a relative pronoun
How do I create uniquely male characters?
How to make payment on the internet without leaving a money trail?
DOS, create pipe for stdin/stdout of command.com(or 4dos.com) in C or Batch?
What do you call a Matrix-like slowdown and camera movement effect?
How do you conduct xenoanthropology after first contact?
declaring a variable twice in IIFE
Can a German sentence have two subjects?
XeLaTeX and pdfLaTeX ignore hyphenation
Why is this code 6.5x slower with optimizations enabled?
How is this relation reflexive?
Infinite past with a beginning?
A Journey Through Space and Time
Why is "Reports" in sentence down without "The"
How old can references or sources in a thesis be?
Is it possible to do 50 km distance without any previous training?
Banach space and Hilbert space topology
Why doesn't Newton's third law mean a person bounces back to where they started when they hit the ground?
Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)
Create one-to-many to two fields in different table
Whether or not to create separate tables for different product types?How to make a table with fields that are other tables in MySQL?Database Design - One table for different types of transactionsUse single table with foreign key or two twin tables for text entries?Separating tables vs having one tableSplit MySql table into two tables with One to many RelationshipMany one-to-many relationships between two tablesUsing a GIN index on an integer array to model sets of tagsHow to use a table when the user identifier can be one of two fieldsHow do I model a many-to-many relationship on two different columns?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a database where I am trying to figure out how to join a table that contains an object called ModelType. The calibration table contains two fields (EffModel and BkgModel) that are based on a ModelType. I cannot figure out how to join these two fields. Below is an image of the stucture. I am trying to make sure that if I were ever to update one of the model types, that I would not have to update the reference Calibration.
I thought about creating a table called EffModelType and BkgModelType, which would separate the two fields depending on the same table but cannot for the life of me think of what would go in it.
Updated Info:
I may have misspoken about EFFModel and BkgModel Being based on Model type. Essentially an example table model type is as follows:
ModelTypeID | ModelName | ModelNumber
+++++++++++++++++++++++++++++++++++++++++++
1 | Linear | 1
2 | Exponential | 2
and the EFFModel will be assigned a model type such as 1 (linear) and the BkgModel will also be assigned a model type, such as 2 (Exponential). Also the ModelNumber is an identifier from another application that will eventually be deleted so it can be ignored.
database-design relational-theory
bumped to the homepage by Community♦ 39 secs ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a database where I am trying to figure out how to join a table that contains an object called ModelType. The calibration table contains two fields (EffModel and BkgModel) that are based on a ModelType. I cannot figure out how to join these two fields. Below is an image of the stucture. I am trying to make sure that if I were ever to update one of the model types, that I would not have to update the reference Calibration.
I thought about creating a table called EffModelType and BkgModelType, which would separate the two fields depending on the same table but cannot for the life of me think of what would go in it.
Updated Info:
I may have misspoken about EFFModel and BkgModel Being based on Model type. Essentially an example table model type is as follows:
ModelTypeID | ModelName | ModelNumber
+++++++++++++++++++++++++++++++++++++++++++
1 | Linear | 1
2 | Exponential | 2
and the EFFModel will be assigned a model type such as 1 (linear) and the BkgModel will also be assigned a model type, such as 2 (Exponential). Also the ModelNumber is an identifier from another application that will eventually be deleted so it can be ignored.
database-design relational-theory
bumped to the homepage by Community♦ 39 secs ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Can you please describe how EffModel and BkgModel are based on ModelType? Is there a calculation based on the Model?
– Twinkles
Apr 16 '14 at 8:29
@Twinkles I have added information to the post.
– ObieMD5
Apr 16 '14 at 15:32
add a comment |
I have a database where I am trying to figure out how to join a table that contains an object called ModelType. The calibration table contains two fields (EffModel and BkgModel) that are based on a ModelType. I cannot figure out how to join these two fields. Below is an image of the stucture. I am trying to make sure that if I were ever to update one of the model types, that I would not have to update the reference Calibration.
I thought about creating a table called EffModelType and BkgModelType, which would separate the two fields depending on the same table but cannot for the life of me think of what would go in it.
Updated Info:
I may have misspoken about EFFModel and BkgModel Being based on Model type. Essentially an example table model type is as follows:
ModelTypeID | ModelName | ModelNumber
+++++++++++++++++++++++++++++++++++++++++++
1 | Linear | 1
2 | Exponential | 2
and the EFFModel will be assigned a model type such as 1 (linear) and the BkgModel will also be assigned a model type, such as 2 (Exponential). Also the ModelNumber is an identifier from another application that will eventually be deleted so it can be ignored.
database-design relational-theory
I have a database where I am trying to figure out how to join a table that contains an object called ModelType. The calibration table contains two fields (EffModel and BkgModel) that are based on a ModelType. I cannot figure out how to join these two fields. Below is an image of the stucture. I am trying to make sure that if I were ever to update one of the model types, that I would not have to update the reference Calibration.
I thought about creating a table called EffModelType and BkgModelType, which would separate the two fields depending on the same table but cannot for the life of me think of what would go in it.
Updated Info:
I may have misspoken about EFFModel and BkgModel Being based on Model type. Essentially an example table model type is as follows:
ModelTypeID | ModelName | ModelNumber
+++++++++++++++++++++++++++++++++++++++++++
1 | Linear | 1
2 | Exponential | 2
and the EFFModel will be assigned a model type such as 1 (linear) and the BkgModel will also be assigned a model type, such as 2 (Exponential). Also the ModelNumber is an identifier from another application that will eventually be deleted so it can be ignored.
database-design relational-theory
database-design relational-theory
edited Apr 16 '14 at 15:32
ObieMD5
asked Apr 16 '14 at 1:15
ObieMD5ObieMD5
1012
1012
bumped to the homepage by Community♦ 39 secs ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 39 secs ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Can you please describe how EffModel and BkgModel are based on ModelType? Is there a calculation based on the Model?
– Twinkles
Apr 16 '14 at 8:29
@Twinkles I have added information to the post.
– ObieMD5
Apr 16 '14 at 15:32
add a comment |
Can you please describe how EffModel and BkgModel are based on ModelType? Is there a calculation based on the Model?
– Twinkles
Apr 16 '14 at 8:29
@Twinkles I have added information to the post.
– ObieMD5
Apr 16 '14 at 15:32
Can you please describe how EffModel and BkgModel are based on ModelType? Is there a calculation based on the Model?
– Twinkles
Apr 16 '14 at 8:29
Can you please describe how EffModel and BkgModel are based on ModelType? Is there a calculation based on the Model?
– Twinkles
Apr 16 '14 at 8:29
@Twinkles I have added information to the post.
– ObieMD5
Apr 16 '14 at 15:32
@Twinkles I have added information to the post.
– ObieMD5
Apr 16 '14 at 15:32
add a comment |
1 Answer
1
active
oldest
votes
I would examine your model and see if it needs some normalization.
It would appear that the two types of model are sub-types of a common model. I have found this kind of implementation requires some design. Using the same id sequencing for both tables opens up a number of options for implementation.
Creating an intermediate Model table containing the Model id, modelTypeID, and any common fields contained in the subtypes also helps. Depending on the query requirements you may be able omit either the subtype tables or the model table from some queries.
If there are few columns in the sub-type tables (EffModel and BkgModel) you may want to add them as nullable columns in the Model table. Alternatively, you can implement the normalized model and use a UNION query, or outer joins to both subtype tables.
In any case you will need to ensure the integrity of the data and ensure the records created match the ModelType.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f63294%2fcreate-one-to-many-to-two-fields-in-different-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I would examine your model and see if it needs some normalization.
It would appear that the two types of model are sub-types of a common model. I have found this kind of implementation requires some design. Using the same id sequencing for both tables opens up a number of options for implementation.
Creating an intermediate Model table containing the Model id, modelTypeID, and any common fields contained in the subtypes also helps. Depending on the query requirements you may be able omit either the subtype tables or the model table from some queries.
If there are few columns in the sub-type tables (EffModel and BkgModel) you may want to add them as nullable columns in the Model table. Alternatively, you can implement the normalized model and use a UNION query, or outer joins to both subtype tables.
In any case you will need to ensure the integrity of the data and ensure the records created match the ModelType.
add a comment |
I would examine your model and see if it needs some normalization.
It would appear that the two types of model are sub-types of a common model. I have found this kind of implementation requires some design. Using the same id sequencing for both tables opens up a number of options for implementation.
Creating an intermediate Model table containing the Model id, modelTypeID, and any common fields contained in the subtypes also helps. Depending on the query requirements you may be able omit either the subtype tables or the model table from some queries.
If there are few columns in the sub-type tables (EffModel and BkgModel) you may want to add them as nullable columns in the Model table. Alternatively, you can implement the normalized model and use a UNION query, or outer joins to both subtype tables.
In any case you will need to ensure the integrity of the data and ensure the records created match the ModelType.
add a comment |
I would examine your model and see if it needs some normalization.
It would appear that the two types of model are sub-types of a common model. I have found this kind of implementation requires some design. Using the same id sequencing for both tables opens up a number of options for implementation.
Creating an intermediate Model table containing the Model id, modelTypeID, and any common fields contained in the subtypes also helps. Depending on the query requirements you may be able omit either the subtype tables or the model table from some queries.
If there are few columns in the sub-type tables (EffModel and BkgModel) you may want to add them as nullable columns in the Model table. Alternatively, you can implement the normalized model and use a UNION query, or outer joins to both subtype tables.
In any case you will need to ensure the integrity of the data and ensure the records created match the ModelType.
I would examine your model and see if it needs some normalization.
It would appear that the two types of model are sub-types of a common model. I have found this kind of implementation requires some design. Using the same id sequencing for both tables opens up a number of options for implementation.
Creating an intermediate Model table containing the Model id, modelTypeID, and any common fields contained in the subtypes also helps. Depending on the query requirements you may be able omit either the subtype tables or the model table from some queries.
If there are few columns in the sub-type tables (EffModel and BkgModel) you may want to add them as nullable columns in the Model table. Alternatively, you can implement the normalized model and use a UNION query, or outer joins to both subtype tables.
In any case you will need to ensure the integrity of the data and ensure the records created match the ModelType.
answered Apr 16 '14 at 3:58
BillThorBillThor
4,2781412
4,2781412
add a comment |
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f63294%2fcreate-one-to-many-to-two-fields-in-different-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you please describe how EffModel and BkgModel are based on ModelType? Is there a calculation based on the Model?
– Twinkles
Apr 16 '14 at 8:29
@Twinkles I have added information to the post.
– ObieMD5
Apr 16 '14 at 15:32