SQLite format 3@ Z)3@~ytoje`[VQLGB=83?_>]=[:X9V8T7R6P5N4L3J2H1E0B/@.>-<,:+7*5)3(1'/&-%+$)#'"%!# !   I{J Ix-EJohn WenSurgical Attending Physician.[q* #9Molly ClockAttending Psychiatrist;%/#Keith DudemeisterMD Resident4^8"#%Doug MurphyPathology MD.[q1%ETodd QuinlanSurgical Attending Physician'(9Bob KelsoHead Chief of Medicine!/%APercival CoxSenior Attending Physician}5-EChristopher TurkSurgical Attending PhysicianCU'#3Elliot ReidAttending Physician >׎##+John DorianStaff Internistk -General Medicine!Psychiatry Surgery)General Medice           ~\97Follicular Demiectomy!CReversible Pancreomyoplasty AObfuscated Dermogastrotomy#7Complete Walletectomy'=Folded Demiophtalmectomy$IObtuse Pyloric Recombobulation;Reverse Rhinopodoplasty 885t+%tablePhysicianPhysicianCREATE TABLE Physician ( EmployeeID INTEGER PRIMARY KEY NOT NULL, Name TEXT NOT NULL, Position TEXT NOT NULL, SSN INTEGER NOT NULL )_!! tableDepartmentDepartmentCREATE TABLE Department ( DepartmentID INTEGER PRIMARY KEY NOT NULL, Name TEXT NOT NULL, Head INTEGER NOT NULL CONSTRAINT fk_Physician_EmployeeID REFERENCES Physician(EmployeeID) )j++ tableAffiliated_WithAffiliated_WithCREATE TABLE Affiliated_With ( Physician INTEGER NOT NULL CONSTRAINT fk_Physician_EmployeeID REFERENCES Physician(EmployeeID), Department INTEGER NOT NULL CONSTRAINT fk_Department_DepartmentID REFERENCES Department(DepartmentID), PrimaryAffiliation BOOLEAN NOT NULL, PRIMARY KEY(Physician, Department) )=Q+indexsqlite_autoindex_Affiliated_With_1Affiliated_With atableProcedureProcedureCREATE TABLE Procedure ( Code INTEGER PRIMARY KEY NOT NULL, Name TEXT NOT NULL, Cost REAL NOT NULL ) +`+0!1Dennis Doe1100 Foobaz Avenue555-20486//Random J. Patient101 Omgbbq Street555-1204M/')Grace Ritchie37 Snafu Drive555-0512-,!)John Smith42 Foobar Lane555-02565 OOn/tablePatientPatientCREATE TABLE Patient ( SSN INTEGER PRIMARY KEY NOT NULL, Name TEXT NOT NULL, Address TEXT NOT NULL, Phone TEXT NOT NULL, InsuranceID INTEGER NOT NULL, PCP INTEGER NOT NULL CONSTRAINT fk_Physician_EmployeeID REFERENCES Physician(EmployeeID) )>[tableNurseNurse CREATE TABLE Nurse ( EmployeeID INTEGER PRIMARY KEY NOT NULL, Name TEXT NOT NULL, Position TEXT NOT NULL, Registered BOOLEAN NOT NULL, SSN INTEGER NOT NULL )N##ctableAppointmentAppointment CREATE TABLE Appointment ( AppointmentID INTEGER PRIMARY KEY NOT NULL, Patient INTEGER NOT NULL CONSTRAINT fk_Patient_SSN REFERENCES Patient(SSN), PrepNurse INTEGER CONSTRAINT fk_Nurse_EmployeeID REFERENCES Nurse(EmployeeID), Physician INTEGER NOT NULL CONSTRAINT fk_Physician_EmployeeID REFERENCES Physician(EmployeeID), Start DATETIME NOT NULL, End DATETIME NOT NULL, ExaminationRoom TEXT NOT NULL ) g%Paul FlowersNurseCRf+Laverne RobertsNurse >׌#e)!Carla EspinosaHead Nursek ,d0`,/$--e2008-04-27 10:002008-04-27 11:00B/3--f 2008-04-27 10:002008-04-21 11:00A.?--2008-04-26 12:002008-04-26 13:00CC/?--g2008-04-26 11:002008-04-26 12:00C.ƠY--2008-04-26 10:002008-04-26 11:00CC/}--g2008-04-25 10:002008-04-25 11:00B/w--f2008-04-25 10:002008-04-25 11:00A/Ե1--e2008-04-24 10:002008-04-24 11:00B/H--e2008-04-24 10:002008-04-24 11:00A bb(#7MelioraurinSnafu PharmaceuticalsN/A!#)CrescavitinBaz IndustriesN/A-AwakinBar LaboratoriesN/AThesisinFoo LabsN/A%Procrastin-XXN/A -N* !!tableMedicationMedication CREATE TABLE Medication ( Code INTEGER PRIMARY KEY NOT NULL, Name TEXT NOT NULL, Brand TEXT NOT NULL, Description TEXT NOT NULL ) !!tablePrescribesPrescribesCREATE TABLE Prescribes ( Physician INTEGER NOT NULL CONSTRAINT fk_Physician_EmployeeID REFERENCES Physician(EmployeeID), Patient INTEGER NOT NULL CONSTRAINT fk_Patient_SSN REFERENCES Patient(SSN), Medication INTEGER NOT NULL CONSTRAINT fk_Medication_Code REFERENCES Medication(Code), Date DATETIME NOT NULL, Appointment INTEGER CONSTRAINT fk_Appointment_AppointmentID REFERENCES Appointment(AppointmentID), Dose TEXT NOT NULL, PRIMARY KEY(Physician, Patient, Medication, Date) )3 G!indexsqlite_autoindex_Prescribes_1Prescribes{ UtableBlockBlockCREATE TABLE Block ( Floor INTEGER NOT NULL, Code INTEGER NOT NULL, PRIMARY KEY(Floor, Code) ) - 2008-04-30 16:535#- 2008-04-27 10:53#310"-2008-04-24 10:47ɫH5 - 2008-04-30 16:53- 2008-04-27 10:53-2008-04-24 10:47           $xgUC1 }kYG5#'Single&Single%SingleSingleSingleSingleSingleSingleSingleCSingleBSingleASingle9Single8Single7Single/Single.Single-Single_Single^Single]SingleUSingleTSingleSSingleKSingleJSingleISingle{SinglezSingleySingleqSinglepSingleoSinglegSinglefSingleeSingle .) =indexsqlite_autoindex_Block_1Block-=tableRoomRoomCREATE TABLE Room ( Number INTEGER PRIMARY KEY NOT NULL, Type TEXT NOT NULL, BlockFloor INTEGER NOT NULL CONSTRAINT fk_Block_Floor REFERENCES Block(Floor), BlockCode INTEGER NOT NULL CONSTRAINT fk_Block_Code REFERENCES Block(Code), Unavailable BOOLEAN NOT NULL ) tableOn_CallOn_CallCREATE TABLE On_Call ( Nurse INTEGER NOT NULL CONSTRAINT fk_Nurse_EmployeeID REFERENCES Nurse(EmployeeID), BlockFloor INTEGER NOT NULL CONSTRAINT fk_Block_Floor REFERENCES Block(Floor), BlockCode INTEGER NOT NULL CONSTRAINT fk_Block_Code REFERENCES Block(Code), Start DATETIME NOT NULL, End DATETIME NOT NULL, PRIMARY KEY(Nurse, BlockFloor, BlockCode, Start, End) )-Aindexsqlite_autoindex_On_Call_1On_Call T))--g2008-11-04 19:002008-11-05 03:00)--g2008-11-04 19:002008-11-05 03:00)--g2008-11-04 19:002008-11-05 03:00)--f2008-11-04 11:002008-11-04 19:00)--e2008-11-04 11:002008-11-04 19:00)--e2008-11-04 11:002008-11-04 19:00 |P$+--g2008-11-04 19:002008-11-05 03:00+--g2008-11-04 19:002008-11-05 03:00+--g2008-11-04 19:002008-11-05 03:00+--f2008-11-04 11:002008-11-04 19:00+--e2008-11-04 11:002008-11-04 19:00+--e2008-11-04 11:002008-11-04 19:00 !!p2008-05-022008-05-03!!{2008-05-032008-05-14!!o2008-05-012008-05-04 %-tableStayStayCREATE TABLE Stay ( StayID INTEGER PRIMARY KEY NOT NULL, Patient INTEGER NOT NULL CONSTRAINT fk_Patient_SSN REFERENCES Patient(SSN), Room INTEGER NOT NULL CONSTRAINT fk_Room_Number REFERENCES Room(Number), Start DATETIME NOT NULL, End DATETIME NOT NULL )<GtableUndergoesUndergoesCREATE TABLE Undergoes ( Patient INTEGER NOT NULL CONSTRAINT fk_Patient_SSN REFERENCES Patient(SSN), Procedure INTEGER NOT NULL CONSTRAINT fk_Procedure_Code REFERENCES Procedure(Code), Stay INTEGER NOT NULL CONSTRAINT fk_Stay_StayID REFERENCES Stay(StayID), Date DATETIME NOT NULL, Physician INTEGER NOT NULL CONSTRAINT fk_Physician_EmployeeID REFERENCES Physician(EmployeeID), AssistingNurse INTEGER CONSTRAINT fk_Nurse_EmployeeID REFERENCES Nurse(EmployeeID), PRIMARY KEY(Patient, Procedure, Stay, Date) ) XtX! 2008-05-13g! 2008-05-10e! 2008-05-09e! 2008-05-07f! 2008-05-03e! 2008-05-02e jj! 2008-05-13! 2008-05-10! 2008-05-09! 2008-05-07! 2008-05-03! 2008-05-02 v1Eindexsqlite_autoindex_Undergoes_1Undergoes]! triggerfki_Department_Head_Physician_EmployeeIDDepartmentCREATE TRIGGER fki_Department_Head_Physician_EmployeeID BEFORE INSERT ON [Department] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Department" violates foreign key constraint "fki_Department_Head_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Head) IS NULL; END]!triggerfku_Department_Head_Physician_EmployeeIDDepartmentCREATE TRIGGER fku_Department_Head_Physician_EmployeeID BEFORE UPDATE ON [Department] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Department" violates foreign key constraint "fku_Department_Head_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Head) IS NULL; END J{]triggerfkd_Department_Head_Physician_EmployeeIDPhysicianCREATE TRIGGER fkd_Department_Head_Physician_EmployeeID BEFORE DELETE ON Physician FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Physician" violates foreign key constraint "fkd_Department_Head_Physician_EmployeeID"') WHERE (SELECT Head FROM Department WHERE Head = OLD.EmployeeID) IS NOT NULL; END3q+Striggerfki_Affiliated_With_Physician_Physician_EmployeeIDAffiliated_WithCREATE TRIGGER fki_Affiliated_With_Physician_Physician_EmployeeID BEFORE INSERT ON [Affiliated_With] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Affiliated_With" violates foreign key constraint "fki_Affiliated_With_Physician_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Physician) IS NULL; END U9q+_triggerfku_Affiliated_With_Physician_Physician_EmployeeIDAffiliated_WithCREATE TRIGGER fku_Affiliated_With_Physician_Physician_EmployeeID BEFORE UPDATE ON [Affiliated_With] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Affiliated_With" violates foreign key constraint "fku_Affiliated_With_Physician_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Physician) IS NULL; END(qItriggerfkd_Affiliated_With_Physician_Physician_EmployeeIDPhysicianCREATE TRIGGER fkd_Affiliated_With_Physician_Physician_EmployeeID BEFORE DELETE ON Physician FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Physician" violates foreign key constraint "fkd_Affiliated_With_Physician_Physician_EmployeeID"') WHERE (SELECT Physician FROM Affiliated_With WHERE Physician = OLD.EmployeeID) IS NOT NULL; END jj2Ey+otriggerfki_Affiliated_With_Department_Department_DepartmentIDAffiliated_WithCREATE TRIGGER fki_Affiliated_With_Department_Department_DepartmentID BEFORE INSERT ON [Affiliated_With] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Affiliated_With" violates foreign key constraint "fki_Affiliated_With_Department_Department_DepartmentID"') WHERE (SELECT DepartmentID FROM Department WHERE DepartmentID = NEW.Department) IS NULL; ENDKy+{triggerfku_Affiliated_With_Department_Department_DepartmentIDAffiliated_WithCREATE TRIGGER fku_Affiliated_With_Department_Department_DepartmentID BEFORE UPDATE ON [Affiliated_With] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Affiliated_With" violates foreign key constraint "fku_Affiliated_With_Department_Department_DepartmentID"') WHERE (SELECT DepartmentID FROM Department WHERE DepartmentID = NEW.Department) IS NULL; END ;y!etriggerfkd_Affiliated_With_Department_Department_DepartmentIDDepartmentCREATE TRIGGER fkd_Affiliated_With_Department_Department_DepartmentID BEFORE DELETE ON Department FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Department" violates foreign key constraint "fkd_Affiliated_With_Department_Department_DepartmentID"') WHERE (SELECT Department FROM Affiliated_With WHERE Department = OLD.DepartmentID) IS NOT NULL; ENDkUotriggerfki_Patient_PCP_Physician_EmployeeIDPatientCREATE TRIGGER fki_Patient_PCP_Physician_EmployeeID BEFORE INSERT ON [Patient] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Patient" violates foreign key constraint "fki_Patient_PCP_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.PCP) IS NULL; END qU{triggerfku_Patient_PCP_Physician_EmployeeIDPatientCREATE TRIGGER fku_Patient_PCP_Physician_EmployeeID BEFORE UPDATE ON [Patient] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Patient" violates foreign key constraint "fku_Patient_PCP_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.PCP) IS NULL; ENDjUitriggerfkd_Patient_PCP_Physician_EmployeeIDPhysicianCREATE TRIGGER fkd_Patient_PCP_Physician_EmployeeID BEFORE DELETE ON Physician FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Physician" violates foreign key constraint "fkd_Patient_PCP_Physician_EmployeeID"') WHERE (SELECT PCP FROM Patient WHERE PCP = OLD.EmployeeID) IS NOT NULL; END $$h S#ctriggerfki_Appointment_Patient_Patient_SSNAppointmentCREATE TRIGGER fki_Appointment_Patient_Patient_SSN BEFORE INSERT ON [Appointment] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Appointment" violates foreign key constraint "fki_Appointment_Patient_Patient_SSN"') WHERE (SELECT SSN FROM Patient WHERE SSN = NEW.Patient) IS NULL; ENDn!S#otriggerfku_Appointment_Patient_Patient_SSNAppointmentCREATE TRIGGER fku_Appointment_Patient_Patient_SSN BEFORE UPDATE ON [Appointment] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Appointment" violates foreign key constraint "fku_Appointment_Patient_Patient_SSN"') WHERE (SELECT SSN FROM Patient WHERE SSN = NEW.Patient) IS NULL; END Tf"Sgtriggerfkd_Appointment_Patient_Patient_SSNPatientCREATE TRIGGER fkd_Appointment_Patient_Patient_SSN BEFORE DELETE ON Patient FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Patient" violates foreign key constraint "fkd_Appointment_Patient_Patient_SSN"') WHERE (SELECT Patient FROM Appointment WHERE Patient = OLD.SSN) IS NOT NULL; END)#a#Wtriggerfki_Appointment_PrepNurse_Nurse_EmployeeIDAppointmentCREATE TRIGGER fki_Appointment_PrepNurse_Nurse_EmployeeID BEFORE INSERT ON [Appointment] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Appointment" violates foreign key constraint "fki_Appointment_PrepNurse_Nurse_EmployeeID"') WHERE NEW.PrepNurse IS NOT NULL AND (SELECT EmployeeID FROM Nurse WHERE EmployeeID = NEW.PrepNurse) IS NULL; END }/$a#ctriggerfku_Appointment_PrepNurse_Nurse_EmployeeIDAppointmentCREATE TRIGGER fku_Appointment_PrepNurse_Nurse_EmployeeID BEFORE UPDATE ON [Appointment] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Appointment" violates foreign key constraint "fku_Appointment_PrepNurse_Nurse_EmployeeID"') WHERE NEW.PrepNurse IS NOT NULL AND (SELECT EmployeeID FROM Nurse WHERE EmployeeID = NEW.PrepNurse) IS NULL; END%atriggerfkd_Appointment_PrepNurse_Nurse_EmployeeIDNurseCREATE TRIGGER fkd_Appointment_PrepNurse_Nurse_EmployeeID BEFORE DELETE ON Nurse FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Nurse" violates foreign key constraint "fkd_Appointment_PrepNurse_Nurse_EmployeeID"') WHERE (SELECT PrepNurse FROM Appointment WHERE PrepNurse = OLD.EmployeeID) IS NOT NULL; END \&i#3triggerfki_Appointment_Physician_Physician_EmployeeIDAppointmentCREATE TRIGGER fki_Appointment_Physician_Physician_EmployeeID BEFORE INSERT ON [Appointment] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Appointment" violates foreign key constraint "fki_Appointment_Physician_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Physician) IS NULL; END!'i#?triggerfku_Appointment_Physician_Physician_EmployeeIDAppointmentCREATE TRIGGER fku_Appointment_Physician_Physician_EmployeeID BEFORE UPDATE ON [Appointment] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Appointment" violates foreign key constraint "fku_Appointment_Physician_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Physician) IS NULL; END h(i1triggerfkd_Appointment_Physician_Physician_EmployeeIDPhysicianCREATE TRIGGER fkd_Appointment_Physician_Physician_EmployeeID BEFORE DELETE ON Physician FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Physician" violates foreign key constraint "fkd_Appointment_Physician_Physician_EmployeeID"') WHERE (SELECT Physician FROM Appointment WHERE Physician = OLD.EmployeeID) IS NOT NULL; END)g!+triggerfki_Prescribes_Physician_Physician_EmployeeIDPrescribesCREATE TRIGGER fki_Prescribes_Physician_Physician_EmployeeID BEFORE INSERT ON [Prescribes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Prescribes" violates foreign key constraint "fki_Prescribes_Physician_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Physician) IS NULL; END i*g!7triggerfku_Prescribes_Physician_Physician_EmployeeIDPrescribesCREATE TRIGGER fku_Prescribes_Physician_Physician_EmployeeID BEFORE UPDATE ON [Prescribes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Prescribes" violates foreign key constraint "fku_Prescribes_Physician_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Physician) IS NULL; END+g+triggerfkd_Prescribes_Physician_Physician_EmployeeIDPhysicianCREATE TRIGGER fkd_Prescribes_Physician_Physician_EmployeeID BEFORE DELETE ON Physician FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Physician" violates foreign key constraint "fkd_Prescribes_Physician_Physician_EmployeeID"') WHERE (SELECT Physician FROM Prescribes WHERE Physician = OLD.EmployeeID) IS NOT NULL; END 00b,Q![triggerfki_Prescribes_Patient_Patient_SSNPrescribesCREATE TRIGGER fki_Prescribes_Patient_Patient_SSN BEFORE INSERT ON [Prescribes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Prescribes" violates foreign key constraint "fki_Prescribes_Patient_Patient_SSN"') WHERE (SELECT SSN FROM Patient WHERE SSN = NEW.Patient) IS NULL; ENDh-Q!gtriggerfku_Prescribes_Patient_Patient_SSNPrescribesCREATE TRIGGER fku_Prescribes_Patient_Patient_SSN BEFORE UPDATE ON [Prescribes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Prescribes" violates foreign key constraint "fku_Prescribes_Patient_Patient_SSN"') WHERE (SELECT SSN FROM Patient WHERE SSN = NEW.Patient) IS NULL; END ~b.Qatriggerfkd_Prescribes_Patient_Patient_SSNPatientCREATE TRIGGER fkd_Prescribes_Patient_Patient_SSN BEFORE DELETE ON Patient FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Patient" violates foreign key constraint "fkd_Prescribes_Patient_Patient_SSN"') WHERE (SELECT Patient FROM Prescribes WHERE Patient = OLD.SSN) IS NOT NULL; END/_!triggerfki_Prescribes_Medication_Medication_CodePrescribesCREATE TRIGGER fki_Prescribes_Medication_Medication_Code BEFORE INSERT ON [Prescribes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Prescribes" violates foreign key constraint "fki_Prescribes_Medication_Medication_Code"') WHERE (SELECT Code FROM Medication WHERE Code = NEW.Medication) IS NULL; END v0_!triggerfku_Prescribes_Medication_Medication_CodePrescribesCREATE TRIGGER fku_Prescribes_Medication_Medication_Code BEFORE UPDATE ON [Prescribes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Prescribes" violates foreign key constraint "fku_Prescribes_Medication_Medication_Code"') WHERE (SELECT Code FROM Medication WHERE Code = NEW.Medication) IS NULL; END1_!triggerfkd_Prescribes_Medication_Medication_CodeMedicationCREATE TRIGGER fkd_Prescribes_Medication_Medication_Code BEFORE DELETE ON Medication FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Medication" violates foreign key constraint "fkd_Prescribes_Medication_Medication_Code"') WHERE (SELECT Medication FROM Prescribes WHERE Medication = OLD.Code) IS NOT NULL; END LL#T2u!triggerfki_Prescribes_Appointment_Appointment_AppointmentIDPrescribesCREATE TRIGGER fki_Prescribes_Appointment_Appointment_AppointmentID BEFORE INSERT ON [Prescribes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Prescribes" violates foreign key constraint "fki_Prescribes_Appointment_Appointment_AppointmentID"') WHERE NEW.Appointment IS NOT NULL AND (SELECT AppointmentID FROM Appointment WHERE AppointmentID = NEW.Appointment) IS NULL; ENDZ3u!'triggerfku_Prescribes_Appointment_Appointment_AppointmentIDPrescribesCREATE TRIGGER fku_Prescribes_Appointment_Appointment_AppointmentID BEFORE UPDATE ON [Prescribes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Prescribes" violates foreign key constraint "fku_Prescribes_Appointment_Appointment_AppointmentID"') WHERE NEW.Appointment IS NOT NULL AND (SELECT AppointmentID FROM Appointment WHERE AppointmentID = NEW.Appointment) IS NULL; END 64u#]triggerfkd_Prescribes_Appointment_Appointment_AppointmentIDAppointmentCREATE TRIGGER fkd_Prescribes_Appointment_Appointment_AppointmentID BEFORE DELETE ON Appointment FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Appointment" violates foreign key constraint "fkd_Prescribes_Appointment_Appointment_AppointmentID"') WHERE (SELECT Appointment FROM Prescribes WHERE Appointment = OLD.AppointmentID) IS NOT NULL; ENDL5KAtriggerfki_Room_BlockFloor_Block_FloorRoomCREATE TRIGGER fki_Room_BlockFloor_Block_Floor BEFORE INSERT ON [Room] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Room" violates foreign key constraint "fki_Room_BlockFloor_Block_Floor"') WHERE (SELECT Floor FROM Block WHERE Floor = NEW.BlockFloor) IS NULL; END SSR6KMtriggerfku_Room_BlockFloor_Block_FloorRoomCREATE TRIGGER fku_Room_BlockFloor_Block_Floor BEFORE UPDATE ON [Room] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Room" violates foreign key constraint "fku_Room_BlockFloor_Block_Floor"') WHERE (SELECT Floor FROM Block WHERE Floor = NEW.BlockFloor) IS NULL; ENDU7KQtriggerfkd_Room_BlockFloor_Block_FloorBlockCREATE TRIGGER fkd_Room_BlockFloor_Block_Floor BEFORE DELETE ON Block FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Block" violates foreign key constraint "fkd_Room_BlockFloor_Block_Floor"') WHERE (SELECT BlockFloor FROM Room WHERE BlockFloor = OLD.Floor) IS NOT NULL; END eC8G3triggerfki_Room_BlockCode_Block_CodeRoomCREATE TRIGGER fki_Room_BlockCode_Block_Code BEFORE INSERT ON [Room] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Room" violates foreign key constraint "fki_Room_BlockCode_Block_Code"') WHERE (SELECT Code FROM Block WHERE Code = NEW.BlockCode) IS NULL; ENDI9G?triggerfku_Room_BlockCode_Block_CodeRoomCREATE TRIGGER fku_Room_BlockCode_Block_Code BEFORE UPDATE ON [Room] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Room" violates foreign key constraint "fku_Room_BlockCode_Block_Code"') WHERE (SELECT Code FROM Block WHERE Code = NEW.BlockCode) IS NULL; ENDL:GCtriggerfkd_Room_BlockCode_Block_CodeBlockCREATE TRIGGER fkd_Room_BlockCode_Block_Code BEFORE DELETE ON Block FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Block" violates foreign key constraint "fkd_Room_BlockCode_Block_Code"') WHERE (SELECT BlockCode FROM Room WHERE BlockCode = OLD.Code) IS NOT NULL; END ..c;Qctriggerfki_On_Call_Nurse_Nurse_EmployeeIDOn_CallCREATE TRIGGER fki_On_Call_Nurse_Nurse_EmployeeID BEFORE INSERT ON [On_Call] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "On_Call" violates foreign key constraint "fki_On_Call_Nurse_Nurse_EmployeeID"') WHERE (SELECT EmployeeID FROM Nurse WHERE EmployeeID = NEW.Nurse) IS NULL; ENDi<Qotriggerfku_On_Call_Nurse_Nurse_EmployeeIDOn_CallCREATE TRIGGER fku_On_Call_Nurse_Nurse_EmployeeID BEFORE UPDATE ON [On_Call] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "On_Call" violates foreign key constraint "fku_On_Call_Nurse_Nurse_EmployeeID"') WHERE (SELECT EmployeeID FROM Nurse WHERE EmployeeID = NEW.Nurse) IS NULL; END @@\=QYtriggerfkd_On_Call_Nurse_Nurse_EmployeeIDNurseCREATE TRIGGER fkd_On_Call_Nurse_Nurse_EmployeeID BEFORE DELETE ON Nurse FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Nurse" violates foreign key constraint "fkd_On_Call_Nurse_Nurse_EmployeeID"') WHERE (SELECT Nurse FROM On_Call WHERE Nurse = OLD.EmployeeID) IS NOT NULL; END^>QYtriggerfki_On_Call_BlockFloor_Block_FloorOn_CallCREATE TRIGGER fki_On_Call_BlockFloor_Block_Floor BEFORE INSERT ON [On_Call] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "On_Call" violates foreign key constraint "fki_On_Call_BlockFloor_Block_Floor"') WHERE (SELECT Floor FROM Block WHERE Floor = NEW.BlockFloor) IS NULL; END 55d?Qetriggerfku_On_Call_BlockFloor_Block_FloorOn_CallCREATE TRIGGER fku_On_Call_BlockFloor_Block_Floor BEFORE UPDATE ON [On_Call] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "On_Call" violates foreign key constraint "fku_On_Call_BlockFloor_Block_Floor"') WHERE (SELECT Floor FROM Block WHERE Floor = NEW.BlockFloor) IS NULL; ENDa@Qctriggerfkd_On_Call_BlockFloor_Block_FloorBlockCREATE TRIGGER fkd_On_Call_BlockFloor_Block_Floor BEFORE DELETE ON Block FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Block" violates foreign key constraint "fkd_On_Call_BlockFloor_Block_Floor"') WHERE (SELECT BlockFloor FROM On_Call WHERE BlockFloor = OLD.Floor) IS NOT NULL; END JJUAMKtriggerfki_On_Call_BlockCode_Block_CodeOn_CallCREATE TRIGGER fki_On_Call_BlockCode_Block_Code BEFORE INSERT ON [On_Call] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "On_Call" violates foreign key constraint "fki_On_Call_BlockCode_Block_Code"') WHERE (SELECT Code FROM Block WHERE Code = NEW.BlockCode) IS NULL; END[BMWtriggerfku_On_Call_BlockCode_Block_CodeOn_CallCREATE TRIGGER fku_On_Call_BlockCode_Block_Code BEFORE UPDATE ON [On_Call] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "On_Call" violates foreign key constraint "fku_On_Call_BlockCode_Block_Code"') WHERE (SELECT Code FROM Block WHERE Code = NEW.BlockCode) IS NULL; END xXCMUtriggerfkd_On_Call_BlockCode_Block_CodeBlockCREATE TRIGGER fkd_On_Call_BlockCode_Block_Code BEFORE DELETE ON Block FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Block" violates foreign key constraint "fkd_On_Call_BlockCode_Block_Code"') WHERE (SELECT BlockCode FROM On_Call WHERE BlockCode = OLD.Code) IS NOT NULL; END>DE+triggerfki_Stay_Patient_Patient_SSNStayCREATE TRIGGER fki_Stay_Patient_Patient_SSN BEFORE INSERT ON [Stay] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Stay" violates foreign key constraint "fki_Stay_Patient_Patient_SSN"') WHERE (SELECT SSN FROM Patient WHERE SSN = NEW.Patient) IS NULL; ENDDEE7triggerfku_Stay_Patient_Patient_SSNStayCREATE TRIGGER fku_Stay_Patient_Patient_SSN BEFORE UPDATE ON [Stay] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Stay" violates foreign key constraint "fku_Stay_Patient_Patient_SSN"') WHERE (SELECT SSN FROM Patient WHERE SSN = NEW.Patient) IS NULL; END ==JFE=triggerfkd_Stay_Patient_Patient_SSNPatientCREATE TRIGGER fkd_Stay_Patient_Patient_SSN BEFORE DELETE ON Patient FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Patient" violates foreign key constraint "fkd_Stay_Patient_Patient_SSN"') WHERE (SELECT Patient FROM Stay WHERE Patient = OLD.SSN) IS NOT NULL; END5G?triggerfki_Stay_Room_Room_NumberStayCREATE TRIGGER fki_Stay_Room_Room_Number BEFORE INSERT ON [Stay] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Stay" violates foreign key constraint "fki_Stay_Room_Room_Number"') WHERE (SELECT Number FROM Room WHERE Number = NEW.Room) IS NULL; END;H?+triggerfku_Stay_Room_Room_NumberStayCREATE TRIGGER fku_Stay_Room_Room_Number BEFORE UPDATE ON [Stay] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Stay" violates foreign key constraint "fku_Stay_Room_Room_Number"') WHERE (SELECT Number FROM Room WHERE Number = NEW.Room) IS NULL; END ii5I?triggerfkd_Stay_Room_Room_NumberRoomCREATE TRIGGER fkd_Stay_Room_Room_Number BEFORE DELETE ON Room FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Room" violates foreign key constraint "fkd_Stay_Room_Room_Number"') WHERE (SELECT Room FROM Stay WHERE Room = OLD.Number) IS NOT NULL; END\JOStriggerfki_Undergoes_Patient_Patient_SSNUndergoesCREATE TRIGGER fki_Undergoes_Patient_Patient_SSN BEFORE INSERT ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Undergoes" violates foreign key constraint "fki_Undergoes_Patient_Patient_SSN"') WHERE (SELECT SSN FROM Patient WHERE SSN = NEW.Patient) IS NULL; END ::bKO_triggerfku_Undergoes_Patient_Patient_SSNUndergoesCREATE TRIGGER fku_Undergoes_Patient_Patient_SSN BEFORE UPDATE ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Undergoes" violates foreign key constraint "fku_Undergoes_Patient_Patient_SSN"') WHERE (SELECT SSN FROM Patient WHERE SSN = NEW.Patient) IS NULL; END^LO[triggerfkd_Undergoes_Patient_Patient_SSNPatientCREATE TRIGGER fkd_Undergoes_Patient_Patient_SSN BEFORE DELETE ON Patient FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Patient" violates foreign key constraint "fkd_Undergoes_Patient_Patient_SSN"') WHERE (SELECT Patient FROM Undergoes WHERE Patient = OLD.SSN) IS NOT NULL; END qMYstriggerfki_Undergoes_Procedure_Procedure_CodeUndergoesCREATE TRIGGER fki_Undergoes_Procedure_Procedure_Code BEFORE INSERT ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Undergoes" violates foreign key constraint "fki_Undergoes_Procedure_Procedure_Code"') WHERE (SELECT Code FROM Procedure WHERE Code = NEW.Procedure) IS NULL; ENDwNYtriggerfku_Undergoes_Procedure_Procedure_CodeUndergoesCREATE TRIGGER fku_Undergoes_Procedure_Procedure_Code BEFORE UPDATE ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Undergoes" violates foreign key constraint "fku_Undergoes_Procedure_Procedure_Code"') WHERE (SELECT Code FROM Procedure WHERE Code = NEW.Procedure) IS NULL; END //xOYtriggerfkd_Undergoes_Procedure_Procedure_CodeProcedureCREATE TRIGGER fkd_Undergoes_Procedure_Procedure_Code BEFORE DELETE ON Procedure FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Procedure" violates foreign key constraint "fkd_Undergoes_Procedure_Procedure_Code"') WHERE (SELECT Procedure FROM Undergoes WHERE Procedure = OLD.Code) IS NOT NULL; ENDSPIGtriggerfki_Undergoes_Stay_Stay_StayIDUndergoesCREATE TRIGGER fki_Undergoes_Stay_Stay_StayID BEFORE INSERT ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Undergoes" violates foreign key constraint "fki_Undergoes_Stay_Stay_StayID"') WHERE (SELECT StayID FROM Stay WHERE StayID = NEW.Stay) IS NULL; END XXYQIStriggerfku_Undergoes_Stay_Stay_StayIDUndergoesCREATE TRIGGER fku_Undergoes_Stay_Stay_StayID BEFORE UPDATE ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Undergoes" violates foreign key constraint "fku_Undergoes_Stay_Stay_StayID"') WHERE (SELECT StayID FROM Stay WHERE StayID = NEW.Stay) IS NULL; ENDIRI=triggerfkd_Undergoes_Stay_Stay_StayIDStayCREATE TRIGGER fkd_Undergoes_Stay_Stay_StayID BEFORE DELETE ON Stay FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Stay" violates foreign key constraint "fkd_Undergoes_Stay_Stay_StayID"') WHERE (SELECT Stay FROM Undergoes WHERE Stay = OLD.StayID) IS NOT NULL; END hSe#triggerfki_Undergoes_Physician_Physician_EmployeeIDUndergoesCREATE TRIGGER fki_Undergoes_Physician_Physician_EmployeeID BEFORE INSERT ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Undergoes" violates foreign key constraint "fki_Undergoes_Physician_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Physician) IS NULL; ENDTe/triggerfku_Undergoes_Physician_Physician_EmployeeIDUndergoesCREATE TRIGGER fku_Undergoes_Physician_Physician_EmployeeID BEFORE UPDATE ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'update on table "Undergoes" violates foreign key constraint "fku_Undergoes_Physician_Physician_EmployeeID"') WHERE (SELECT EmployeeID FROM Physician WHERE EmployeeID = NEW.Physician) IS NULL; END GUe%triggerfkd_Undergoes_Physician_Physician_EmployeeIDPhysicianCREATE TRIGGER fkd_Undergoes_Physician_Physician_EmployeeID BEFORE DELETE ON Physician FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'delete on table "Physician" violates foreign key constraint "fkd_Undergoes_Physician_Physician_EmployeeID"') WHERE (SELECT Physician FROM Undergoes WHERE Physician = OLD.EmployeeID) IS NOT NULL; END6Vgotriggerfki_Undergoes_AssistingNurse_Nurse_EmployeeIDUndergoesCREATE TRIGGER fki_Undergoes_AssistingNurse_Nurse_EmployeeID BEFORE INSERT ON [Undergoes] FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, 'insert on table "Undergoes" violates foreign key constraint "fki_Undergoes_AssistingNurse_Nurse_EmployeeID"') WHERE NEW.AssistingNurse IS NOT NULL AND (SELECT EmployeeID FROM Nurse WHERE EmployeeID = NEW.AssistingNurse) IS NULL; END l