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 "Match" (
"id" INT,
"home_team_api_id" INT,
PRIMARY KEY ("id")
);

CREATE TABLE "Player" (
"id" INT,
"player_api_id" INT UNIQUE,
"player_name" TEXT,
"birthday" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_api_id" INT,
"date" TEXT,
"overall_rating" INT,
"potential" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("player_api_id") REFERENCES "Player"("player_api_id")
);



INSERT INTO "Match" VALUES ("1", "1001");
INSERT INTO "Match" VALUES ("2", "1002");
INSERT INTO "Player" VALUES ("1", "5001", "Francesco Parravicini", "1982-03-21");
INSERT INTO "Player" VALUES ("2", "5002", "Luca Toni", "1977-05-26");
INSERT INTO "Player" VALUES ("3", "5003", "Andrea Pirlo", "1979-05-19");
INSERT INTO "Player_Attributes" VALUES ("1", "5001", "2010-08-30 00:00:00", "72", "75");
INSERT INTO "Player_Attributes" VALUES ("2", "5001", "2010-09-15 00:00:00", "73", "76");
INSERT INTO "Player_Attributes" VALUES ("3", "5002", "2010-08-30 00:00:00", "80", "80");
INSERT INTO "Player_Attributes" VALUES ("4", "5003", "2010-08-30 00:00:00", "85", "85");
INSERT INTO "Player_Attributes" VALUES ("5", "5001", "2009-12-01 00:00:00", "70", "74");
INSERT INTO "Player_Attributes" VALUES ("6", "5001", "2011-01-01 00:00:00", "74", "77");