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 "Match" VALUES ("3", "1003");
INSERT INTO "Player" VALUES ("1", "5001", "Gabriel Tamas", "1983-02-09");
INSERT INTO "Player" VALUES ("2", "5002", "John Smith", "1990-07-15");
INSERT INTO "Player" VALUES ("3", "5003", "Alex Johnson", "1988-11-23");
INSERT INTO "Player_Attributes" VALUES ("1", "5001", "2010-05-20", "70", "75");
INSERT INTO "Player_Attributes" VALUES ("2", "5001", "2011-03-15", "72", "76");
INSERT INTO "Player_Attributes" VALUES ("3", "5001", "2011-11-10", "74", "77");
INSERT INTO "Player_Attributes" VALUES ("4", "5001", "2012-06-05", "75", "78");
INSERT INTO "Player_Attributes" VALUES ("5", "5002", "2011-08-22", "65", "70");
INSERT INTO "Player_Attributes" VALUES ("6", "5003", "2011-09-30", "68", "72");
INSERT INTO "Player_Attributes" VALUES ("7", "5003", "2012-01-15", "69", "73");