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" (
"aCL IgG" FLOAT,
"ANA" INT,
"Diagnosis" TEXT
);

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

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



INSERT INTO "Patient" VALUES ("1", "2005-05-20");
INSERT INTO "Patient" VALUES ("2", "2010-11-15");
INSERT INTO "Patient" VALUES ("3", "2012-07-30");
INSERT INTO "Patient" VALUES ("4", "2008-03-10");
INSERT INTO "Patient" VALUES ("5", "2012-07-30");
INSERT INTO "Patient" VALUES ("6", "2015-01-01");
INSERT INTO "Patient" VALUES ("7", "2014-12-31");
INSERT INTO "Patient" VALUES ("8", "2009-09-09");
INSERT INTO "Patient" VALUES ("9", "2013-06-20");
INSERT INTO "Patient" VALUES ("10", "2011-04-25");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "negative");
INSERT INTO "Laboratory" VALUES ("1", "2023-06-15", "positive");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-20", "0");
INSERT INTO "Laboratory" VALUES ("2", "2023-07-01", "weak positive");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-05", "positive");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-12", "negative");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-18", "positive");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-22", "weak positive");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-30", "0");
INSERT INTO "Laboratory" VALUES ("7", "2023-08-15", "positive");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-20", "negative");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-10", "positive");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-05", "0");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-20", "weak positive");