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,
"birthday" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_fifa_api_id" INT,
"player_api_id" INT,
"date" TEXT,
"overall_rating" INT,
"attacking_work_rate" TEXT,
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")
);

CREATE TABLE "Team_Attributes" (
"id" INT,
"chanceCreationShooting" INT,
PRIMARY KEY ("id")
);



INSERT INTO "Player" VALUES ("1", "1001", "Francesco Migliore", "5001", "1990-03-15");
INSERT INTO "Player" VALUES ("2", "1002", "Luca Bianchi", "5002", "1988-07-22");
INSERT INTO "Player" VALUES ("3", "1003", "Marco Rossi", "5003", "1992-11-05");
INSERT INTO "Player_Attributes" VALUES ("1", "5001", "1001", "2015-05-01 10:00:00", "78", "High");
INSERT INTO "Player_Attributes" VALUES ("2", "5001", "1001", "2015-04-30 15:00:00", "77", "Medium");
INSERT INTO "Player_Attributes" VALUES ("3", "5002", "1002", "2015-05-01 09:00:00", "82", "Low");
INSERT INTO "Player_Attributes" VALUES ("4", "5003", "1003", "2015-05-01 11:00:00", "80", "High");
INSERT INTO "Player_Attributes" VALUES ("5", "5001", "1001", "2015-05-02 12:00:00", "79", "Medium");
INSERT INTO "Team_Attributes" VALUES ("1", "85");
INSERT INTO "Team_Attributes" VALUES ("2", "90");
INSERT INTO "Team_Attributes" VALUES ("3", "75");