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

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

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



INSERT INTO "Patient" VALUES ("1", "F", "1995-06-15", "Rheumatoid Arthritis");
INSERT INTO "Patient" VALUES ("2", "M", "1996-11-20", "Osteoarthritis");
INSERT INTO "Patient" VALUES ("3", "F", "1997-01-10", "Fibromyalgia");
INSERT INTO "Patient" VALUES ("4", "M", "1997-01-27", "Undifferentiated Connective Tissue Disease");
INSERT INTO "Patient" VALUES ("5", "F", "1998-03-05", "Psoriatic Arthritis");
INSERT INTO "Examination" VALUES ("1", "1995-06-15", "Rheumatoid Arthritis", "0");
INSERT INTO "Examination" VALUES ("1", "1997-01-27", "SLE", "1");
INSERT INTO "Examination" VALUES ("2", "1996-11-20", "Osteoarthritis", "0");
INSERT INTO "Examination" VALUES ("3", "1997-01-10", "Fibromyalgia", "0");
INSERT INTO "Examination" VALUES ("4", "1997-01-27", "SLE", "1");
INSERT INTO "Examination" VALUES ("4", "1997-02-15", "SLE", "1");
INSERT INTO "Examination" VALUES ("5", "1998-03-05", "Psoriatic Arthritis", "0");
INSERT INTO "Laboratory" VALUES ("1", "1995-06-15");
INSERT INTO "Laboratory" VALUES ("1", "1997-01-27");
INSERT INTO "Laboratory" VALUES ("2", "1996-11-20");
INSERT INTO "Laboratory" VALUES ("3", "1997-01-10");
INSERT INTO "Laboratory" VALUES ("4", "1997-01-27");
INSERT INTO "Laboratory" VALUES ("4", "1997-02-15");
INSERT INTO "Laboratory" VALUES ("5", "1998-03-05");