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

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

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



INSERT INTO "Patient" VALUES ("1", "2023-01-15", "2023-01-01");
INSERT INTO "Patient" VALUES ("2", "NULL", "2023-02-01");
INSERT INTO "Patient" VALUES ("3", "2023-03-10", "2023-03-01");
INSERT INTO "Patient" VALUES ("4", "NULL", "2023-04-01");
INSERT INTO "Patient" VALUES ("5", "2023-05-20", "2023-05-01");
INSERT INTO "Patient" VALUES ("6", "NULL", "2023-06-01");
INSERT INTO "Patient" VALUES ("7", "2023-07-25", "2023-07-01");
INSERT INTO "Patient" VALUES ("8", "NULL", "2023-08-01");
INSERT INTO "Patient" VALUES ("9", "2023-09-30", "2023-09-01");
INSERT INTO "Patient" VALUES ("10", "NULL", "2023-10-01");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "5");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-05", "7");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-08", "10");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-03", "6");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-15", "9");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-07", "4");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-20", "12");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-02", "7");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-25", "11");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-05", "5");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-10", "9");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-15", "3");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-20", "8");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-10", "6");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-12", "10");
INSERT INTO "Examination" VALUES ("1", "100");
INSERT INTO "Examination" VALUES ("2", "120");
INSERT INTO "Examination" VALUES ("3", "80");
INSERT INTO "Examination" VALUES ("4", "90");
INSERT INTO "Examination" VALUES ("5", "110");
INSERT INTO "Examination" VALUES ("6", "70");
INSERT INTO "Examination" VALUES ("7", "130");
INSERT INTO "Examination" VALUES ("8", "95");
INSERT INTO "Examination" VALUES ("9", "105");
INSERT INTO "Examination" VALUES ("10", "85");