-- Patient Table
CREATE TABLE Patient (
PatientID INT PRIMARY KEY,
Surname VARCHAR(50),
FirstName VARCHAR(50),
DOB DATE,
Sex CHAR(1),
Weight DECIMAL(5,2),
Height DECIMAL(5,2),
Vaccinated CHAR(1)
);
INSERT INTO Patient VALUES
(15223, 'Smith', 'Deniz', '2018-12-31', 'F', 21.4, 29.2, 'Y'),
(15224, 'Agarwal', 'Arjun', '2017-08-29', 'M', 28.1, 34.2, 'Y'),
(15225, 'Adams', 'Poppy', '2015-02-14', 'F', 34.0, 39.2, 'N'),
(15226, 'Johnson', 'Tierra', '2019-08-15', 'F', 14.6, 24.5, 'Y'),
(15227, 'Khouri', 'Mohammed', '2014-03-30', 'M', 41.5, 44.1, 'Y'),
(15228, 'Jones', 'Ben', '2011-04-04', 'M', 70.1, 52.2, 'Y'),
(15229, 'Kowalczyk', 'Alexandra', '2019-08-27', 'F', 15.2, 23.9, 'Y');
-- Department Table
CREATE TABLE Department (
DepartmentID INT PRIMARY KEY,
DepartmentName VARCHAR(50),
GroupName VARCHAR(50),
CategoryName VARCHAR(50)
);
INSERT INTO Department VALUES
(1, 'Cardiology', 'Heart Center', 'Clinical'),
(2, 'Central ICU', 'Emergency', 'Clinical'),
(3, 'Emergency', 'Emergency', 'Clinical'),
(4, 'Communications', 'Administration', 'Operational'),
(5, 'Oncology', 'Internal Medicine', 'Clinical'),
(6, 'Neurology', 'Internal Medicine', 'Clinical'),
(7, 'Human Resources', 'Administration', 'Operational'),
(8, 'Pathology', 'Service', 'Technical'),
(9, 'Radiology', 'Service', 'Technical'),
(10, 'Pharmacy', 'Service', 'Technical'),
(11, 'Executive Board', 'Administration', 'Operational'),
(12, 'Urology', 'Surgery', 'Clinical'),
(13, 'Hematology', 'Internal Medicine', 'Clinical'),
(14, 'Montana Ward', 'Ward', 'Operational'),
(15, 'Chicago Ward', 'Ward', 'Operational'),
(16, 'Lincoln Ward', 'Ward', 'Operational');
-- PatientAdmittance Table
CREATE TABLE PatientAdmittance (
PatientID INT,
LastAdmitted DATE,
LastDischarged DATE,
DepartmentID INT,
FOREIGN KEY (PatientID) REFERENCES Patient(PatientID),
FOREIGN KEY (DepartmentID) REFERENCES Department(DepartmentID)
);
INSERT INTO PatientAdmittance VALUES
(15223, '2024-01-05', '2024-01-11', 1),
(15224, '2024-01-13', '2024-01-26', 12),
(15226, '2024-02-02', '2024-02-07', 3),
(15227, '2024-02-05', '2024-02-08', 5),
(15227, '2024-03-05', '2024-03-09', 6);