DB Design – Different tables that share a common table – each has their own values

database-design

I have a Persons table. This table has two tables depended on, the Clients and Clerks tables, Persons has many Clerks and Persons has many Clients

Something like this, visually:

Persons
|     \

Clerks Clients

Clients and Clerks both need a relation with Locations table; both the Clients and the Clerks has a latitude, longitude combination and many other geographic related elements. I'm not sure about this approach: I cannot link the Clerks and Clients table with a one to one relationship, because Locations will have two foreign keys from different tables.

Persons
|     \

Clerks Clients

 \        /
  Locations

Is there another approach?

Best Answer

Is there another approach?

The alternative approach is to use the "Table-per-Hierarchy" design, and store all types of Persons in a single table, eg

create table Persons
(
  Id int primary key,
  PersonType char(6) check PersonType in ('Clerk','Client'),
  LocationId int references Locations,
  . . .
)