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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"APTT" INT,
PRIMARY KEY ("ID", "Date")
);

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



INSERT INTO "Patient" VALUES ("1", "1980-05-10");
INSERT INTO "Patient" VALUES ("2", "1995-11-22");
INSERT INTO "Patient" VALUES ("3", "1970-01-15");
INSERT INTO "Patient" VALUES ("4", "2000-03-01");
INSERT INTO "Patient" VALUES ("5", "1965-07-07");
INSERT INTO "Patient" VALUES ("6", "1992-09-18");
INSERT INTO "Patient" VALUES ("7", "1988-02-29");
INSERT INTO "Patient" VALUES ("8", "1975-06-30");
INSERT INTO "Patient" VALUES ("9", "2005-12-05");
INSERT INTO "Patient" VALUES ("10", "1950-04-01");
INSERT INTO "Examination" VALUES ("1", "Normal", "+");
INSERT INTO "Examination" VALUES ("2", "Thrombosis", "-");
INSERT INTO "Examination" VALUES ("3", "Normal", "+");
INSERT INTO "Examination" VALUES ("4", "Bleeding", "-");
INSERT INTO "Examination" VALUES ("5", "Thrombosis", "+");
INSERT INTO "Examination" VALUES ("6", "Normal", "-");
INSERT INTO "Examination" VALUES ("7", "Thrombosis", "+");
INSERT INTO "Examination" VALUES ("8", "Normal", "+");
INSERT INTO "Examination" VALUES ("9", "Bleeding", "-");
INSERT INTO "Examination" VALUES ("10", "Normal", "+");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-01", "30");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "32");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-01", "45");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-01", "28");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-10", "29");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-01", "50");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-01", "31");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-01", "40");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-01", "27");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-01", "33");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-01", "55");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-01", "25");