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

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

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"SEX" TEXT,
"Description" DATE,
"Admission" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "F", "1997-01-15", "-");
INSERT INTO "Patient" VALUES ("2", "M", "1997-02-20", "Inpatient");
INSERT INTO "Patient" VALUES ("3", "F", "1997-03-10", "-");
INSERT INTO "Patient" VALUES ("4", "F", "1998-04-01", "-");
INSERT INTO "Patient" VALUES ("5", "M", "1997-05-05", "-");
INSERT INTO "Patient" VALUES ("6", "F", "1997-06-12", "Inpatient");
INSERT INTO "Patient" VALUES ("7", "F", "1997-07-22", "-");
INSERT INTO "Patient" VALUES ("8", "M", "1996-08-30", "-");
INSERT INTO "Patient" VALUES ("9", "F", "1997-09-01", "-");
INSERT INTO "Patient" VALUES ("10", "F", "1997-10-10", "Inpatient");
INSERT INTO "Examination" VALUES ("1", "Thrombosis");
INSERT INTO "Examination" VALUES ("2", "Flu");
INSERT INTO "Examination" VALUES ("3", "Thrombosis");
INSERT INTO "Examination" VALUES ("4", "Cold");
INSERT INTO "Examination" VALUES ("5", "Thrombosis");
INSERT INTO "Examination" VALUES ("6", "Thrombosis");
INSERT INTO "Examination" VALUES ("7", "Thrombosis");
INSERT INTO "Examination" VALUES ("8", "Flu");
INSERT INTO "Examination" VALUES ("9", "Thrombosis");
INSERT INTO "Examination" VALUES ("10", "Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "1997-01-15");
INSERT INTO "Laboratory" VALUES ("2", "1997-02-20");
INSERT INTO "Laboratory" VALUES ("3", "1997-03-10");
INSERT INTO "Laboratory" VALUES ("4", "1998-04-01");
INSERT INTO "Laboratory" VALUES ("5", "1997-05-05");
INSERT INTO "Laboratory" VALUES ("6", "1997-06-12");
INSERT INTO "Laboratory" VALUES ("7", "1997-07-22");
INSERT INTO "Laboratory" VALUES ("8", "1996-08-30");
INSERT INTO "Laboratory" VALUES ("9", "1997-09-01");
INSERT INTO "Laboratory" VALUES ("10", "1997-10-10");