{"club": {"columns": [[0, "Club_ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Region", "TEXT", 0, null, 0], [3, "Start_year", "TEXT", 0, null, 0]], "primary_keys": ["Club_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Club_ID"]]], "check_constraints": []}, "club_rank": {"columns": [[0, "Rank", "REAL", 0, null, 1], [1, "Club_ID", "INT", 0, null, 2], [2, "Gold", "REAL", 0, null, 0], [3, "Silver", "REAL", 0, null, 0], [4, "Bronze", "REAL", 0, null, 0], [5, "Total", "REAL", 0, null, 0]], "primary_keys": ["Rank", "Club_ID"], "foreign_keys": [[0, 0, "club", "Club_ID", "Club_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Rank"], [1, 1, "Club_ID"]]], "check_constraints": []}, "player": {"columns": [[0, "Player_ID", "INT", 0, null, 1], [1, "name", "TEXT", 0, null, 0], [2, "Position", "TEXT", 0, null, 0], [3, "Club_ID", "INT", 0, null, 0], [4, "Apps", "REAL", 0, null, 0], [5, "Tries", "REAL", 0, null, 0], [6, "Goals", "TEXT", 0, null, 0], [7, "Points", "REAL", 0, null, 0]], "primary_keys": ["Player_ID"], "foreign_keys": [[0, 0, "club", "Club_ID", "Club_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Player_ID"]]], "check_constraints": []}, "competition": {"columns": [[0, "Competition_ID", "INT", 0, null, 1], [1, "Year", "REAL", 0, null, 0], [2, "Competition_type", "TEXT", 0, null, 0], [3, "Country", "TEXT", 0, null, 0]], "primary_keys": ["Competition_ID"], "foreign_keys": [], "unique_constraints": [[[0, 0, "Competition_ID"]]], "check_constraints": []}, "competition_result": {"columns": [[0, "Competition_ID", "INT", 0, null, 1], [1, "Club_ID_1", "INT", 0, null, 2], [2, "Club_ID_2", "INT", 0, null, 3], [3, "Score", "TEXT", 0, null, 0]], "primary_keys": ["Competition_ID", "Club_ID_1", "Club_ID_2"], "foreign_keys": [[0, 0, "competition", "Competition_ID", "Competition_ID", "NO ACTION", "NO ACTION", "NONE"], [1, 0, "club", "Club_ID_2", "Club_ID", "NO ACTION", "NO ACTION", "NONE"], [2, 0, "club", "Club_ID_1", "Club_ID", "NO ACTION", "NO ACTION", "NONE"]], "unique_constraints": [[[0, 0, "Competition_ID"], [1, 1, "Club_ID_1"], [2, 2, "Club_ID_2"]]], "check_constraints": []}}
CREATE TABLE club (
    Club_ID INT   PRIMARY KEY,
    name TEXT,
    Region TEXT,
    Start_year TEXT,
    UNIQUE (Club_ID)
);

CREATE TABLE club_rank (
    Rank REAL   PRIMARY KEY,
    Club_ID INT   PRIMARY KEY,
    Gold REAL,
    Silver REAL,
    Bronze REAL,
    Total REAL,
    PRIMARY KEY (Rank, Club_ID),
    UNIQUE (Rank, Club_ID),
    FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
);

CREATE TABLE player (
    Player_ID INT   PRIMARY KEY,
    name TEXT,
    Position TEXT,
    Club_ID INT,
    Apps REAL,
    Tries REAL,
    Goals TEXT,
    Points REAL,
    UNIQUE (Player_ID),
    FOREIGN KEY (Club_ID) REFERENCES club(Club_ID)
);

CREATE TABLE competition (
    Competition_ID INT   PRIMARY KEY,
    Year REAL,
    Competition_type TEXT,
    Country TEXT,
    UNIQUE (Competition_ID)
);

CREATE TABLE competition_result (
    Competition_ID INT   PRIMARY KEY,
    Club_ID_1 INT   PRIMARY KEY,
    Club_ID_2 INT   PRIMARY KEY,
    Score TEXT,
    PRIMARY KEY (Competition_ID, Club_ID_1, Club_ID_2),
    UNIQUE (Competition_ID, Club_ID_1, Club_ID_2),
    FOREIGN KEY (Competition_ID) REFERENCES competition(Competition_ID),
    FOREIGN KEY (Club_ID_2) REFERENCES club(Club_ID),
    FOREIGN KEY (Club_ID_1) REFERENCES club(Club_ID)
);