PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "Examination" (
"Examination Date" DATE,
"Diagnosis" TEXT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"SEX" TEXT,
"Birthday" DATE,
"First Date" DATE,
"Admission" TEXT,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Examination" VALUES ("2023-01-15", "SJS");
INSERT INTO "Examination" VALUES ("2023-02-20", "Flu");
INSERT INTO "Examination" VALUES ("2023-03-10", "SJS");
INSERT INTO "Examination" VALUES ("2023-04-05", "Cold");
INSERT INTO "Examination" VALUES ("2023-05-01", "SJS");
INSERT INTO "Examination" VALUES ("2023-06-12", "SJS");
INSERT INTO "Examination" VALUES ("2023-07-25", "SJS");
INSERT INTO "Examination" VALUES ("2023-08-30", "SJS");
INSERT INTO "Examination" VALUES ("2023-09-18", "SJS");
INSERT INTO "Examination" VALUES ("2023-10-07", "SJS");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-16");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-21");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-11");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-06");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-02");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-13");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-26");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-31");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-19");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-08");
INSERT INTO "Patient" VALUES ("1", "M", "1980-05-10", "2023-01-15", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("2", "F", "1995-11-22", "2023-02-20", "Outpatient", "Flu");
INSERT INTO "Patient" VALUES ("3", "M", "1975-03-01", "2023-03-10", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("4", "F", "2000-07-18", "2023-04-05", "Outpatient", "Cold");
INSERT INTO "Patient" VALUES ("5", "M", "1960-01-01", "2023-05-01", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("6", "F", "1985-09-09", "2023-06-12", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("7", "M", "1970-04-25", "2023-07-25", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("8", "F", "1990-12-12", "2023-08-30", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("9", "M", "1965-06-30", "2023-09-18", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("10", "F", "1955-02-14", "2023-10-07", "Emergency", "SJS");