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

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



INSERT INTO "Patient" VALUES ("1", "M", "1970-05-10");
INSERT INTO "Patient" VALUES ("2", "F", "1985-11-22");
INSERT INTO "Patient" VALUES ("3", "M", "1960-01-15");
INSERT INTO "Patient" VALUES ("4", "F", "1990-03-01");
INSERT INTO "Patient" VALUES ("5", "M", "1975-07-07");
INSERT INTO "Patient" VALUES ("6", "F", "1988-09-12");
INSERT INTO "Patient" VALUES ("7", "M", "1965-02-28");
INSERT INTO "Patient" VALUES ("8", "F", "1992-04-04");
INSERT INTO "Patient" VALUES ("9", "M", "1980-06-18");
INSERT INTO "Patient" VALUES ("10", "F", "1972-10-30");
INSERT INTO "Examination" VALUES ("1", "1996-12-25", "Normal");
INSERT INTO "Examination" VALUES ("1", "1997-01-05", "Thrombosis");
INSERT INTO "Examination" VALUES ("2", "1997-02-10", "Normal");
INSERT INTO "Examination" VALUES ("3", "1997-03-15", "Inactivated partial prothrombin time");
INSERT INTO "Examination" VALUES ("4", "1997-04-20", "Normal");
INSERT INTO "Examination" VALUES ("5", "1997-05-25", "Inactivated partial prothrombin time");
INSERT INTO "Examination" VALUES ("6", "1998-01-01", "Normal");
INSERT INTO "Examination" VALUES ("7", "1998-02-05", "Inactivated partial prothrombin time");
INSERT INTO "Examination" VALUES ("8", "1998-03-10", "Thrombosis");
INSERT INTO "Examination" VALUES ("9", "1998-04-15", "Inactivated partial prothrombin time");
INSERT INTO "Examination" VALUES ("10", "1998-05-20", "Normal");
INSERT INTO "Examination" VALUES ("1", "1999-01-01", "Inactivated partial prothrombin time");
INSERT INTO "Examination" VALUES ("2", "1999-02-01", "Normal");
INSERT INTO "Examination" VALUES ("3", "1999-03-01", "Inactivated partial prothrombin time");
INSERT INTO "Examination" VALUES ("4", "1999-04-01", "Normal");
INSERT INTO "Examination" VALUES ("5", "1999-05-01", "Inactivated partial prothrombin time");
INSERT INTO "Laboratory" VALUES ("1", "1996-12-25", "40");
INSERT INTO "Laboratory" VALUES ("1", "1997-01-05", "55");
INSERT INTO "Laboratory" VALUES ("2", "1997-02-10", "38");
INSERT INTO "Laboratory" VALUES ("3", "1997-03-15", "60");
INSERT INTO "Laboratory" VALUES ("4", "1997-04-20", "42");
INSERT INTO "Laboratory" VALUES ("5", "1997-05-25", "70");
INSERT INTO "Laboratory" VALUES ("6", "1998-01-01", "41");
INSERT INTO "Laboratory" VALUES ("7", "1998-02-05", "65");
INSERT INTO "Laboratory" VALUES ("8", "1998-03-10", "58");
INSERT INTO "Laboratory" VALUES ("9", "1998-04-15", "72");
INSERT INTO "Laboratory" VALUES ("10", "1998-05-20", "39");
INSERT INTO "Laboratory" VALUES ("1", "1999-01-01", "62");
INSERT INTO "Laboratory" VALUES ("2", "1999-02-01", "43");
INSERT INTO "Laboratory" VALUES ("3", "1999-03-01", "68");
INSERT INTO "Laboratory" VALUES ("4", "1999-04-01", "40");
INSERT INTO "Laboratory" VALUES ("5", "1999-05-01", "75");