外键,这就是你要找的。person 表中的主键可以被所有其他表引用。
CREATE TABLE person(personId INT PRIMARY KEY IDENTITY(1,1), FirstName VARCHAR(50), LastName VARCHAR(50))
CREATE TABLE staff(id INT PRIMARY KEY IDENTITY(1,1), personId INT REFERENCES person(personId))
CREATE TABLE member(id INT PRIMARY KEY IDENTITY(1,1), personId INT REFERENCES person(personId))
CREATE TABLE supporter(id INT PRIMARY KEY IDENTITY(1,1), personId INT REFERENCES person(personId))
INSERT INTO person VALUES ('Adrian', 'Sullivan'), ('Frank', 'Sullivan'), ('Another', 'Sullivan'),('John', 'Sullivan')
SELECT * FROM person
INSERT INTO staff VALUES (1),(3)
INSERT INTO member VALUES (2),(3),(4)
INSERT INTO supporter VALUES (1),(4)
SELECT
person.personId
, person.FirstName
, person.LastName
, staff.id [IsStaff]
, member.id [IsMember]
, supporter.id [IsSupporter]
FROM person
LEFT OUTER JOIN staff ON person.personid = staff.personId
LEFT OUTER JOIN member ON person.personid = member.personId
LEFT OUTER JOIN supporter ON person.personid = supporter.personId