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,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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

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



INSERT INTO "Patient" VALUES ("1", "M");
INSERT INTO "Patient" VALUES ("2", "F");
INSERT INTO "Patient" VALUES ("3", "M");
INSERT INTO "Patient" VALUES ("4", "F");
INSERT INTO "Patient" VALUES ("5", "M");
INSERT INTO "Patient" VALUES ("6", "F");
INSERT INTO "Patient" VALUES ("7", "M");
INSERT INTO "Patient" VALUES ("8", "F");
INSERT INTO "Patient" VALUES ("9", "M");
INSERT INTO "Patient" VALUES ("10", "F");
INSERT INTO "Examination" VALUES ("1", "1996-12-25", "Thrombosis");
INSERT INTO "Examination" VALUES ("2", "1998-03-10", "No Thrombosis");
INSERT INTO "Examination" VALUES ("3", "1997-01-01", "Thrombosis");
INSERT INTO "Examination" VALUES ("4", "1999-07-15", "No Thrombosis");
INSERT INTO "Examination" VALUES ("5", "1998-01-05", "Thrombosis");
INSERT INTO "Examination" VALUES ("6", "2000-02-20", "No Thrombosis");
INSERT INTO "Examination" VALUES ("7", "1997-05-01", "Thrombosis");
INSERT INTO "Examination" VALUES ("8", "1996-11-11", "No Thrombosis");
INSERT INTO "Examination" VALUES ("9", "1998-09-30", "Thrombosis");
INSERT INTO "Examination" VALUES ("10", "1997-01-02", "No Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "1996-12-20", "positive");
INSERT INTO "Laboratory" VALUES ("2", "1998-03-05", "negative");
INSERT INTO "Laboratory" VALUES ("3", "1997-01-01", "positive");
INSERT INTO "Laboratory" VALUES ("4", "1999-07-10", "0");
INSERT INTO "Laboratory" VALUES ("5", "1998-01-01", "positive");
INSERT INTO "Laboratory" VALUES ("6", "2000-02-15", "negative");
INSERT INTO "Laboratory" VALUES ("7", "1997-04-25", "0");
INSERT INTO "Laboratory" VALUES ("8", "1996-11-05", "negative");
INSERT INTO "Laboratory" VALUES ("9", "1998-09-25", "positive");
INSERT INTO "Laboratory" VALUES ("10", "1997-01-01", "negative");