basketball league database schema
- User
basketball league database schema
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
basketball league database schema
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Below is an example of a relational database schema for a basketball league. This design covers several key entities such as teams, players, coaches, games, and player statistics. You can further customize it to your needs. One way to represent the schema is with the following SQL DDL statements:
CREATE TABLE Teams (
team_id INT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
location VARCHAR(100),
arena VARCHAR(100),
established_year INT
);
Explanation: The Teams table captures basic information about each team, including a unique identifier, the team name, their location, arena (home court), and the year the team was established.
CREATE TABLE Coaches (
coach_id INT PRIMARY KEY,
team_id INT,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
hire_date DATE,
FOREIGN KEY (team_id) REFERENCES Teams(team_id)
);
Explanation: The Coaches table stores coach information. A coach can be associated with a team via the foreign key. Depending on your needs, you might allow multiple coaches per team or a history of coaches.
CREATE TABLE Players (
player_id INT PRIMARY KEY,
team_id INT,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
birth_date DATE,
position VARCHAR(20),
height_cm INT,
weight_kg INT,
draft_year INT,
FOREIGN KEY (team_id) REFERENCES Teams(team_id)
);
Explanation: The Players table holds each player’s profile and ties them to a team. Fields such as position, height, and weight can help manage player data for scouting or statistics.
CREATE TABLE Seasons (
season_id INT PRIMARY KEY,
start_year INT,
end_year INT,
description VARCHAR(100)
);
Explanation: The Seasons table tracks league seasons so that games and statistics can be associated with a particular season.
CREATE TABLE Games (
game_id INT PRIMARY KEY,
season_id INT,
game_date DATE,
home_team_id INT,
away_team_id INT,
home_team_score INT,
away_team_score INT,
venue VARCHAR(100),
FOREIGN KEY (season_id) REFERENCES Seasons(season_id),
FOREIGN KEY (home_team_id) REFERENCES Teams(team_id),
FOREIGN KEY (away_team_id) REFERENCES Teams(team_id)
);
Explanation: The Games table records the outcome of each match. It includes foreign keys for the season as well as for both home and away teams. Scores and venue are also stored.
CREATE TABLE PlayerGameStats (
stat_id INT PRIMARY KEY,
game_id INT,
player_id INT,
minutes_played INT,
points INT,
rebounds INT,
assists INT,
steals INT,
blocks INT,
turnovers INT,
fouls INT,
FOREIGN KEY (game_id) REFERENCES Games(game_id),
FOREIGN KEY (player_id) REFERENCES Players(player_id)
);
Explanation: PlayerGameStats logs the performance of each player in individual games. This table stores various statistics like points, assists, and rebounds.
game_date, season_id).PlayerTeamHistory) rather than storing just the current team in the Players table.Referees, TeamStatistics, or Awards may be added to meet more advanced requirements.This schema provides a solid starting point for a basketball league database. Modify or extend these tables based on your specific business requirements and application logic.