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 "matches" (
"surface" TEXT,
"tourney_date" DATE
);

CREATE TABLE "players" (
"player_id" INT UNIQUE,
"first_name" TEXT,
"country_code" TEXT,
PRIMARY KEY ("player_id")
);

CREATE TABLE "rankings" (
"ranking" INT,
"player_id" INT,
"tours" INT,
FOREIGN KEY ("player_id") REFERENCES "players"("player_id")
);





INSERT INTO "matches" VALUES ("Clay", "2023-04-10");
INSERT INTO "matches" VALUES ("Grass", "2023-06-15");
INSERT INTO "matches" VALUES ("Hard", "2023-01-20");
INSERT INTO "matches" VALUES ("Clay", "2023-05-05");
INSERT INTO "matches" VALUES ("Hard", "2023-07-01");
INSERT INTO "players" VALUES ("1", "Serena", "USA");
INSERT INTO "players" VALUES ("2", "Naomi", "JPN");
INSERT INTO "players" VALUES ("3", "Simona", "ROU");
INSERT INTO "players" VALUES ("4", "Ashleigh", "AUS");
INSERT INTO "players" VALUES ("5", "Iga", "POL");
INSERT INTO "rankings" VALUES ("1", "1", "25");
INSERT INTO "rankings" VALUES ("2", "2", "30");
INSERT INTO "rankings" VALUES ("3", "3", "28");
INSERT INTO "rankings" VALUES ("4", "4", "30");
INSERT INTO "rankings" VALUES ("5", "5", "22");