Click here to Skip to main content
15,912,897 members
Home / Discussions / Database
   

Database

 
GeneralRe: How to select First Name? Pin
Paul Conrad21-Jan-06 6:48
professionalPaul Conrad21-Jan-06 6:48 
QuestionMYSQL ERROR Pin
hbjs18-Jan-06 16:19
hbjs18-Jan-06 16:19 
AnswerRe: MYSQL ERROR Pin
hbjs18-Jan-06 16:46
hbjs18-Jan-06 16:46 
QuestionSQL 2005 - Auto connect to DB engines Pin
cmk18-Jan-06 14:46
cmk18-Jan-06 14:46 
AnswerRe: SQL 2005 - Auto connect to DB engines Pin
Dave Kreskowiak20-Jan-06 4:41
mveDave Kreskowiak20-Jan-06 4:41 
GeneralRe: SQL 2005 - Auto connect to DB engines Pin
cmk20-Jan-06 11:36
cmk20-Jan-06 11:36 
QuestionSQL Table Design Pin
Alexandru Serban18-Jan-06 10:39
professionalAlexandru Serban18-Jan-06 10:39 
AnswerRe: SQL Table Design Pin
Russell Nash19-Jan-06 1:54
Russell Nash19-Jan-06 1:54 
You have a couple of options.

One is to use triggers on the Person and Company tables to do brute force referential integrity on the EntityID table.

Another is to take your second idea, and just roll it into the Contract table itself. That is, create an FK field for Person, and an FK field for Company, in the Contract table. Yes, this is poor normalization. However, you aren't gaining anything by splitting this out into an Entity table, and you're just increasing the complexity.

Another is to create a pair of intermediary tables. Create a ContractPerson table, that handles contracts to people, and a ContractCompany table, that handles contracts to companies. You would need to add some logic, probably through triggers, to make sure that you don't have the same ContractID in both tables.

But, probably your best bet is actually to drop back a step further. What exactly is the practical difference between Persons and Companies? You may want to significantly expand your Entity table to actually be the core of the system. It would include any information that is common to any customer, such as address. You would add a field that indicates if the Entity is a Person, Company, or whatever other categories you might have. You would then make child tables that handle data unique to the type of Entity.


GeneralRe: SQL Table Design Pin
Alexandru Serban19-Jan-06 2:26
professionalAlexandru Serban19-Jan-06 2:26 
GeneralRe: SQL Table Design Pin
Russell Nash19-Jan-06 2:56
Russell Nash19-Jan-06 2:56 
QuestionGenerate Unique ID Pin
mcgann18-Jan-06 6:53
mcgann18-Jan-06 6:53 
AnswerRe: Generate Unique ID Pin
Farhan Noor Qureshi18-Jan-06 7:24
Farhan Noor Qureshi18-Jan-06 7:24 
QuestionER Diagrams Pin
kids1718-Jan-06 5:07
kids1718-Jan-06 5:07 
AnswerRe: ER Diagrams Pin
Colin Angus Mackay18-Jan-06 5:28
Colin Angus Mackay18-Jan-06 5:28 
QuestionMoving data between servers Pin
Russell Nash18-Jan-06 2:54
Russell Nash18-Jan-06 2:54 
GeneralRe: Moving data between servers Pin
PolarbearDK18-Jan-06 4:57
PolarbearDK18-Jan-06 4:57 
AnswerRe: Moving data between servers Pin
Farhan Noor Qureshi18-Jan-06 7:34
Farhan Noor Qureshi18-Jan-06 7:34 
Questionquery for unique customers Pin
imsathy18-Jan-06 2:22
imsathy18-Jan-06 2:22 
AnswerRe: query for unique customers Pin
Colin Angus Mackay18-Jan-06 2:50
Colin Angus Mackay18-Jan-06 2:50 
QuestionRe: query for unique customers Pin
imsathy18-Jan-06 3:17
imsathy18-Jan-06 3:17 
AnswerRe: query for unique customers Pin
Colin Angus Mackay18-Jan-06 4:00
Colin Angus Mackay18-Jan-06 4:00 
GeneralRe: query for unique customers Pin
imsathy18-Jan-06 18:32
imsathy18-Jan-06 18:32 
QuestionHow to assign dataset in Reporting Services 2005? Pin
Diego F.17-Jan-06 22:48
Diego F.17-Jan-06 22:48 
Questionmultiple update problem in datagrid Pin
sood_is_in17-Jan-06 21:24
sood_is_in17-Jan-06 21:24 
AnswerRe: multiple update problem in datagrid Pin
Alexandru Serban18-Jan-06 10:59
professionalAlexandru Serban18-Jan-06 10:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.