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,
"height" INT,
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", "John Smith", "1985-04-12", "180");
INSERT INTO "Player" VALUES ("2", "5002", "Alex Johnson", "1983-11-30", "175");
INSERT INTO "Player" VALUES ("3", "5003", "Michael Brown", "1990-01-15", "182");
INSERT INTO "Player" VALUES ("4", "5004", "Chris Davis", "1983-11-30", "178");
INSERT INTO "Player" VALUES ("5", "5005", "David Wilson", "1987-07-22", "185");
INSERT INTO "Player_Attributes" VALUES ("1", "5001", "2016-06-23", "77", "80");
INSERT INTO "Player_Attributes" VALUES ("2", "5002", "2016-06-23", "77", "82");
INSERT INTO "Player_Attributes" VALUES ("3", "5003", "2016-06-23", "75", "78");
INSERT INTO "Player_Attributes" VALUES ("4", "5004", "2016-06-23", "77", "79");
INSERT INTO "Player_Attributes" VALUES ("5", "5005", "2016-06-23", "78", "81");
INSERT INTO "Player_Attributes" VALUES ("6", "5001", "2016-06-22", "76", "80");
INSERT INTO "Player_Attributes" VALUES ("7", "5002", "2016-06-24", "77", "82");