A hospital employs surgeons who operate on patients. Patients and surgeons are d
ID: 3908808 • Letter: A
Question
A hospital employs surgeons who operate on patients. Patients and surgeons are described by (unique) id's (integers), names and addresses. Each patient undergoes a single operation that is scheduled on a particular day (of type DATE) and performed by a single surgeon. A surgeon can only perform one operation a day ER diagram that describes this enterprise. Name Date Name Id Address Operation Patient Surgeon Id Address Translate the ER diagram into a schema by supplying the appropriate CREATE TABLE statements. Include all primary and foreign key constraints.Explanation / Answer
If you have any doubts, please give me comment...
CREATE TABLE Patient(
Id INTEGER NOT NULL PRIMARY KEY,
Name VARCHAR(100),
Address VARCHAR(255)
);
CREATE TABLE Surgeon(
Id INTEGER NOT NULL PRIMARY KEY,
Name VARCHAR(100),
Address VARCHAR(255),
PatientId INTEGER,
OperationDate DATE,
FOREIGN KEY(PatientId) REFERENCES Patient(Id)
);