/******************************************************************************//*** Generated by IBExpert 07.10.2010 10:30:23 ***//******************************************************************************//******************************************************************************//*** Tables ***//******************************************************************************/CREATE TABLE MASTER ( ID INTEGER NOT NULL);/******************************************************************************//*** Primary Keys ***//******************************************************************************/ALTER TABLE MASTER ADD CONSTRAINT PK_MASTER PRIMARY KEY (ID);/******************************************************************************//*** Privileges ***//******************************************************************************/
/******************************************************************************//*** Generated by IBExpert 07.10.2010 10:27:55 ***//******************************************************************************//******************************************************************************//*** Tables ***//******************************************************************************/CREATE TABLE SLAVE ( ID INTEGER);/******************************************************************************//*** Foreign Keys ***//******************************************************************************/ALTER TABLE SLAVE ADD CONSTRAINT FK_SLAVE_1 FOREIGN KEY (ID) REFERENCES MASTER (ID) ON DELETE CASCADE ON UPDATE CASCADE;/******************************************************************************//*** Privileges ***//*****************************************************************************/
CREATE OR ALTER trigger master_ai0 for masteractive after insert position 0ASbeginINSERT into slave values (NEW.id);end
DepartmentID - PKNameEmployeeIDDepartmentID - FKNameID, DepartmentID - PK