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,
"ANA Pattern" TEXT,
"Diagnosis" TEXT,
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,
"Birthday" DATE,
"First Date" DATE,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "F", "1985-03-10", "2020-01-15");
INSERT INTO "Patient" VALUES ("2", "M", "1978-11-22", "2019-05-01");
INSERT INTO "Patient" VALUES ("3", "F", "1982-07-01", "2021-02-20");
INSERT INTO "Patient" VALUES ("4", "F", "1990-01-01", "2022-03-10");
INSERT INTO "Patient" VALUES ("5", "M", "1980-06-15", "2020-08-05");
INSERT INTO "Patient" VALUES ("6", "F", "1988-09-30", "2021-11-12");
INSERT INTO "Patient" VALUES ("7", "F", "1975-04-25", "2018-07-01");
INSERT INTO "Patient" VALUES ("8", "M", "1983-12-05", "2022-01-01");
INSERT INTO "Patient" VALUES ("9", "F", "1981-02-14", "2020-04-04");
INSERT INTO "Patient" VALUES ("10", "F", "1986-08-08", "2021-09-09");
INSERT INTO "Patient" VALUES ("11", "F", "1984-05-20", "2023-01-01");
INSERT INTO "Patient" VALUES ("12", "F", "1979-10-10", "2022-06-06");
INSERT INTO "Patient" VALUES ("13", "M", "1991-03-03", "2021-07-07");
INSERT INTO "Patient" VALUES ("14", "F", "1987-11-11", "2020-12-12");
INSERT INTO "Patient" VALUES ("15", "F", "1980-01-01", "2023-02-02");
INSERT INTO "Examination" VALUES ("1", "Homogeneous", "Lupus");
INSERT INTO "Examination" VALUES ("2", "P", "Rheumatoid Arthritis");
INSERT INTO "Examination" VALUES ("3", "Speckled", "Sjogrens Syndrome");
INSERT INTO "Examination" VALUES ("4", "P", "Fibromyalgia");
INSERT INTO "Examination" VALUES ("5", "Nucleolar", "Scleroderma");
INSERT INTO "Examination" VALUES ("6", "Homogeneous", "Lupus");
INSERT INTO "Examination" VALUES ("7", "P", "Undifferentiated CTD");
INSERT INTO "Examination" VALUES ("8", "Speckled", "Mixed CTD");
INSERT INTO "Examination" VALUES ("9", "Homogeneous", "Lupus");
INSERT INTO "Examination" VALUES ("10", "P", "No Autoimmune Disease");
INSERT INTO "Examination" VALUES ("11", "Speckled", "Sjogrens Syndrome");
INSERT INTO "Examination" VALUES ("12", "Homogeneous", "Lupus");
INSERT INTO "Examination" VALUES ("13", "P", "Rheumatoid Arthritis");
INSERT INTO "Examination" VALUES ("14", "Nucleolar", "Scleroderma");
INSERT INTO "Examination" VALUES ("15", "Homogeneous", "Lupus");
INSERT INTO "Laboratory" VALUES ("1", "2020-01-15");
INSERT INTO "Laboratory" VALUES ("1", "2020-06-20");
INSERT INTO "Laboratory" VALUES ("2", "2019-05-01");
INSERT INTO "Laboratory" VALUES ("3", "2021-02-20");
INSERT INTO "Laboratory" VALUES ("4", "2022-03-10");
INSERT INTO "Laboratory" VALUES ("5", "2020-08-05");
INSERT INTO "Laboratory" VALUES ("6", "2021-11-12");
INSERT INTO "Laboratory" VALUES ("7", "2018-07-01");
INSERT INTO "Laboratory" VALUES ("8", "2022-01-01");
INSERT INTO "Laboratory" VALUES ("9", "2020-04-04");
INSERT INTO "Laboratory" VALUES ("10", "2021-09-09");
INSERT INTO "Laboratory" VALUES ("11", "2023-01-01");
INSERT INTO "Laboratory" VALUES ("12", "2022-06-06");
INSERT INTO "Laboratory" VALUES ("13", "2021-07-07");
INSERT INTO "Laboratory" VALUES ("14", "2020-12-12");
INSERT INTO "Laboratory" VALUES ("15", "2023-02-02");