Database logic...
-
I have three different tables in a SQL DB which have at least two common fields amongst each other. Should I just create a new table that is made of these common fields and have these three tables point to it for those fields?
I don't think there is a right or wrong answer to this question. It depends on the data. If the data is vital and it's very important that it's always updated and the same across the three files, you may want to separate and make a fourth table out of it so you only have to update in one location. However, if it's not that vital of information or it very rarely changes you may want to keep it in each file because it's easier to access. Hope this helps.
-
I have three different tables in a SQL DB which have at least two common fields amongst each other. Should I just create a new table that is made of these common fields and have these three tables point to it for those fields?
Depending on your domain model you could approach this as a reference, or an inheritance relationship. Pick the most appropriate. Reference is say pulling out "Address1, Address2, Address3" into a Address table, and have Customer.Address, Supplier.Address -> Address.ID with a fk relationship. Inheritance is where you take out the Address1-3 columns into a Person table, and have Customer.Id -> Person.ID, and Supplier.ID -> Person.ID. (So every record in supplier or customer must have a record in person - this maps directly to inheritance in your business layer, which can be handy).
Mark Churchill Director Dunn & Churchill Free Download:
Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio. -
I have three different tables in a SQL DB which have at least two common fields amongst each other. Should I just create a new table that is made of these common fields and have these three tables point to it for those fields?
Read up on Normalisation - this probably going to be the root issue. The common fields in the table should ONLY be IDs, if you are updating data in 3 different tables then your design is wrong.
Never underestimate the power of human stupidity RAH