All pastes #184906 Raw Edit

Stuff

public text v1 · immutable
#184906 ·published 2006-09-28 12:28 UTC
rendered paste body
OK. Suppose I have three kinds of employees.

I have a table EMPLOYEE with attributes ssnr (PK), name, salary.

Then I have a table WORKER with ssnr (FK to EMPLOYEE.ssnr) and some other attributes; a table SOLDIER with ssnr (FK to EMPLOYEE.ssnr) and some other attributes; and a table THINKER with ssnr (FK to EMPLOYEE.ssnr) and some other attributes.

Now, I want to specify "CONSTRAINT employee_ssnr_fk FOREIGN KEY (snnr) REFERENCES EMPLOYEE(ssnr) ON DELETE ..." for each of WORKER, SOLDIER, THINKER, but I'd rather just define that once than have to copy-and-paste it in its entirety thrice over.