Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Two tables - legal person, natural person.

Author  Topic 

battery2004
Starting Member

1 Post

Posted - 2010-10-27 : 17:25:26
Hello,

my questions is quite simple.

lets say i have 3 tables:
1. Natural person (consists of: id, name, lastname, address, SSN, etc.)
2. Legal person (corporation) (consists of: id, name, address, CEO, etc.)
3. Client

so the client table can consist either of a reference to ID from table "Natural person" as well as "Legal person".

So how would I create such thing. With a "dumb***" logic id put 3 columns in client table (ID, fk: natural person, fk: legal person) and if the row represents natural person id put NULL in legal persons foreign key.

Im quite new to databases, so could someone give a hint?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-11-01 : 12:28:13
you can follow same approach but might be worth putting a checking constraint to ensure at least either of them should have a value.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -