CREATE TABLE hospital (
	hospitalID CHAR(3) CONSTRAINT hID_pk PRIMARY KEY,
	hospitalName VARCHAR(20),
	city VARCHAR(15),
	postcode CHAR(8) CONSTRAINT postcode_unique UNIQUE
);
CREATE TABLE transplantUnit (
	unitID CHAR(4) CONSTRAINT uID_pk PRIMARY KEY,
	hospitalID CHAR(3) CONSTRAINT hID_fk FOREIGN KEY REFERENCES hospital(HospitalID),
	specialisation VARCHAR(10)
);
CREATE TABLE organ (
	organID CHAR(3) CONSTRAINT oID_pk PRIMARY KEY,
	organType VARCHAR(15) 
);
CREATE TABLE patient (
	patientID CHAR(3) CONSTRAINT pID_pk PRIMARY KEY,
	patientName VARCHAR(10),
	age INTEGER
);
CREATE TABLE donor (
	donorID CHAR(3) CONSTRAINT dID_pk PRIMARY KEY,
	donorName VARCHAR(10),
	age INTEGER
);
CREATE TABLE operation (
	operationID CHAR(3) CONSTRAINT opID_pk PRIMARY KEY,
	unitID CHAR(4) CONSTRAINT uID_fk FOREIGN KEY REFERENCES transplantUnit(unitID),
	organID CHAR(3) CONSTRAINT oID_fk FOREIGN KEY REFERENCES organ(organID),
	patientID CHAR(3) CONSTRAINT pID_fk FOREIGN KEY REFERENCES patient(patientID),
	donorID CHAR(3) CONSTRAINT dID_fk FOREIGN KEY REFERENCES donor(donorID)
);