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 "Player" (
"id" INT,
"player_api_id" INT UNIQUE,
"player_name" TEXT,
"player_fifa_api_id" INT UNIQUE,
PRIMARY KEY ("id")
);

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



INSERT INTO "Player" VALUES ("1", "1001", "Aaron Doran", "5001");
INSERT INTO "Player" VALUES ("2", "1002", "John Smith", "5002");
INSERT INTO "Player" VALUES ("3", "1003", "Michael Johnson", "5003");
INSERT INTO "Player" VALUES ("4", "1004", "Aaron Doran", "5004");
INSERT INTO "Player_Attributes" VALUES ("1", "5001", "1001", "75", "80");
INSERT INTO "Player_Attributes" VALUES ("2", "5001", "1001", "78", "82");
INSERT INTO "Player_Attributes" VALUES ("3", "5001", "1001", "74", "79");
INSERT INTO "Player_Attributes" VALUES ("4", "5002", "1002", "65", "70");
INSERT INTO "Player_Attributes" VALUES ("5", "5003", "1003", "85", "90");
INSERT INTO "Player_Attributes" VALUES ("6", "5004", "1004", "60", "65");