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

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

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



INSERT INTO "Patient" VALUES ("3605340", "1970-05-10");
INSERT INTO "Patient" VALUES ("1234567", "1985-11-20");
INSERT INTO "Patient" VALUES ("9876543", "1960-01-15");
INSERT INTO "Patient" VALUES ("1122334", "1992-07-01");
INSERT INTO "Patient" VALUES ("5566778", "1978-03-25");
INSERT INTO "Examination" VALUES ("3605340", "1996-12-02", "160");
INSERT INTO "Examination" VALUES ("3605340", "1997-01-15", "80");
INSERT INTO "Examination" VALUES ("1234567", "2000-06-01", "40");
INSERT INTO "Examination" VALUES ("9876543", "1995-09-10", "320");
INSERT INTO "Examination" VALUES ("3605340", "1996-11-20", "0");
INSERT INTO "Examination" VALUES ("1122334", "2010-04-05", "160");
INSERT INTO "Examination" VALUES ("5566778", "2005-08-12", "80");
INSERT INTO "Laboratory" VALUES ("3605340", "1996-12-02", "Positive");
INSERT INTO "Laboratory" VALUES ("3605340", "1997-01-15", "Negative");
INSERT INTO "Laboratory" VALUES ("1234567", "2000-06-01", "Negative");
INSERT INTO "Laboratory" VALUES ("9876543", "1995-09-10", "Positive");
INSERT INTO "Laboratory" VALUES ("1122334", "2010-04-05", "Positive");
INSERT INTO "Laboratory" VALUES ("5566778", "2005-08-12", "Negative");