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" (
"ID" INT,
"Examination Date" DATE,
"Diagnosis" TEXT,
"Thrombosis" INT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"Admission" TEXT,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "2023-01-10", "Flu");
INSERT INTO "Patient" VALUES ("2", "1990-05-20", "Pneumonia");
INSERT INTO "Patient" VALUES ("3", "1988-07-15", "Bronchitis");
INSERT INTO "Patient" VALUES ("4", "1992-11-30", "Pneumonia");
INSERT INTO "Patient" VALUES ("5", "1984-12-01", "Asthma");
INSERT INTO "Patient" VALUES ("6", "1995-06-25", "Pneumonia");
INSERT INTO "Patient" VALUES ("7", "1993-03-05", "Flu");
INSERT INTO "Patient" VALUES ("8", "1986-09-10", "Bronchitis");
INSERT INTO "Patient" VALUES ("9", "1991-01-20", "Pneumonia");
INSERT INTO "Patient" VALUES ("10", "1983-04-18", "Cold");
INSERT INTO "Examination" VALUES ("1", "2023-01-11", "Flu", "0");
INSERT INTO "Examination" VALUES ("2", "1990-05-21", "Pneumonia", "1");
INSERT INTO "Examination" VALUES ("3", "1988-07-16", "Bronchitis", "0");
INSERT INTO "Examination" VALUES ("4", "1992-12-01", "Pneumonia", "1");
INSERT INTO "Examination" VALUES ("5", "1984-12-02", "Asthma", "0");
INSERT INTO "Examination" VALUES ("6", "1995-06-26", "Pneumonia", "1");
INSERT INTO "Examination" VALUES ("7", "1993-03-06", "Flu", "0");
INSERT INTO "Examination" VALUES ("8", "1986-09-11", "Bronchitis", "0");
INSERT INTO "Examination" VALUES ("9", "1991-01-21", "Pneumonia", "1");
INSERT INTO "Examination" VALUES ("10", "1983-04-19", "Cold", "0");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-12", "5.2");
INSERT INTO "Laboratory" VALUES ("2", "1990-06-01", "12.1");
INSERT INTO "Laboratory" VALUES ("3", "1988-07-20", "7.8");
INSERT INTO "Laboratory" VALUES ("4", "1992-12-05", "11.3");
INSERT INTO "Laboratory" VALUES ("5", "1984-12-10", "3.4");
INSERT INTO "Laboratory" VALUES ("6", "1995-07-01", "13.0");
INSERT INTO "Laboratory" VALUES ("7", "1993-03-10", "6.5");
INSERT INTO "Laboratory" VALUES ("8", "1986-09-15", "8.0");
INSERT INTO "Laboratory" VALUES ("9", "1991-01-25", "10.7");
INSERT INTO "Laboratory" VALUES ("10", "1983-04-20", "4.1");