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 "Laboratory" (
"ID" INT,
"Date" DATE,
"SM" TEXT,
"SSA" TEXT,
"SSB" TEXT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"First Date" DATE,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "2020-01-10", "Diagnosis A");
INSERT INTO "Patient" VALUES ("2", "2019-12-15", "Diagnosis B");
INSERT INTO "Patient" VALUES ("3", "2020-01-05", "Diagnosis C");
INSERT INTO "Patient" VALUES ("4", "2019-12-15", "Diagnosis D");
INSERT INTO "Patient" VALUES ("5", "2020-02-01", "Diagnosis E");
INSERT INTO "Laboratory" VALUES ("1", "2020-01-10", "SM1", "negative", "SSB1");
INSERT INTO "Laboratory" VALUES ("1", "2020-01-15", "SM2", "0", "SSB2");
INSERT INTO "Laboratory" VALUES ("2", "2019-12-15", "SM3", "positive", "SSB3");
INSERT INTO "Laboratory" VALUES ("3", "2020-01-05", "SM4", "negative", "SSB4");
INSERT INTO "Laboratory" VALUES ("3", "2020-01-06", "SM5", "weak positive", "SSB5");
INSERT INTO "Laboratory" VALUES ("4", "2019-12-15", "SM6", "0", "SSB6");
INSERT INTO "Laboratory" VALUES ("5", "2020-02-01", "SM7", "positive", "SSB7");
INSERT INTO "Laboratory" VALUES ("5", "2020-02-05", "SM8", "negative", "SSB8");