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,
PRIMARY KEY ("ID", "Date")
);

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



INSERT INTO "Patient" VALUES ("1", "M", "1970-01-15", "2000-03-10", "2000-03-01", "Emergency", "Pneumonia");
INSERT INTO "Patient" VALUES ("2", "F", "1985-05-20", "2010-07-22", "2010-07-15", "Outpatient", "Diabetes");
INSERT INTO "Patient" VALUES ("3", "M", "1962-11-01", "1995-01-05", "1995-01-01", "Inpatient", "Hypertension");
INSERT INTO "Patient" VALUES ("4", "F", "1990-03-25", "2018-09-12", "2018-09-01", "Emergency", "Appendicitis");
INSERT INTO "Patient" VALUES ("5", "M", "1978-08-10", "2005-04-30", "2005-04-20", "Outpatient", "Asthma");
INSERT INTO "Patient" VALUES ("6", "F", "1955-12-03", "2020-01-01", "2019-12-25", "Inpatient", "Cancer");
INSERT INTO "Patient" VALUES ("7", "M", "1980-06-18", "2015-11-05", "2015-10-28", "Emergency", "Stroke");
INSERT INTO "Patient" VALUES ("8", "F", "1992-02-29", "2022-06-15", "2022-06-01", "Outpatient", "Migraine");
INSERT INTO "Patient" VALUES ("9", "M", "1968-09-07", "2008-02-14", "2008-02-01", "Inpatient", "Kidney Disease");
INSERT INTO "Patient" VALUES ("10", "F", "1975-04-12", "2013-03-20", "2013-03-10", "Emergency", "Heart Attack");
INSERT INTO "Examination" VALUES ("1", "2000-03-10", "Pneumonia", "1");
INSERT INTO "Examination" VALUES ("2", "2010-07-22", "Diabetes", "0");
INSERT INTO "Examination" VALUES ("3", "1995-01-05", "Hypertension", "2");
INSERT INTO "Examination" VALUES ("4", "2018-09-12", "Appendicitis", "0");
INSERT INTO "Examination" VALUES ("5", "2005-04-30", "Asthma", "1");
INSERT INTO "Examination" VALUES ("6", "2020-01-01", "Cancer", "2");
INSERT INTO "Examination" VALUES ("7", "2015-11-05", "Stroke", "2");
INSERT INTO "Examination" VALUES ("8", "2022-06-15", "Migraine", "0");
INSERT INTO "Examination" VALUES ("9", "2008-02-14", "Kidney Disease", "1");
INSERT INTO "Examination" VALUES ("10", "2013-03-20", "Heart Attack", "2");
INSERT INTO "Examination" VALUES ("3", "1996-02-10", "Hypertension", "1");
INSERT INTO "Examination" VALUES ("6", "2021-03-01", "Cancer", "0");
INSERT INTO "Examination" VALUES ("7", "2016-01-20", "Stroke", "1");
INSERT INTO "Examination" VALUES ("1", "2001-05-01", "Pneumonia", "2");
INSERT INTO "Examination" VALUES ("10", "2014-04-05", "Heart Attack", "1");
INSERT INTO "Laboratory" VALUES ("1", "2000-03-09");
INSERT INTO "Laboratory" VALUES ("2", "2010-07-20");
INSERT INTO "Laboratory" VALUES ("3", "1995-01-04");
INSERT INTO "Laboratory" VALUES ("4", "2018-09-10");
INSERT INTO "Laboratory" VALUES ("5", "2005-04-28");
INSERT INTO "Laboratory" VALUES ("6", "2019-12-30");
INSERT INTO "Laboratory" VALUES ("7", "2015-11-03");
INSERT INTO "Laboratory" VALUES ("8", "2022-06-13");
INSERT INTO "Laboratory" VALUES ("9", "2008-02-12");
INSERT INTO "Laboratory" VALUES ("10", "2013-03-18");