0% found this document useful (0 votes)
16 views2 pages

SQL

Uploaded by

Nishant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

SQL

Uploaded by

Nishant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CREATE TABLE teams (

team_id INT AUTO_INCREMENT PRIMARY KEY,


team_name VARCHAR(100) NOT NULL,
coach_name VARCHAR(100) NOT NULL,
stadium_name VARCHAR(100) NOT NULL
);

CREATE TABLE players (


player_id INT AUTO_INCREMENT PRIMARY KEY,
player_name VARCHAR(100) NOT NULL,
position VARCHAR(50) NOT NULL,
team_id INT,
FOREIGN KEY (team_id) REFERENCES teams(team_id)
);

CREATE TABLE events (


event_id INT AUTO_INCREMENT PRIMARY KEY,
event_name VARCHAR(100) NOT NULL,
event_date DATE NOT NULL,
team1_id INT,
team2_id INT,
location VARCHAR(100),
FOREIGN KEY (team1_id) REFERENCES teams(team_id),
FOREIGN KEY (team2_id) REFERENCES teams(team_id)
);

CREATE TABLE revenues (


revenue_id INT AUTO_INCREMENT PRIMARY KEY,
event_id INT,
revenue_amount DECIMAL(10, 2) NOT NULL,
FOREIGN KEY (event_id) REFERENCES events(event_id)
);

INSERT INTO teams (team_name, coach_name, stadium_name)


VALUES
('Football Team A', 'John Doe', 'Football Stadium A'),
('Basketball Team B', 'Jane Smith', 'Basketball Arena B'),
('Tennis Team C', 'Michael Johnson', 'Tennis Court C'),
('Baseball Team D', 'Emily Davis', 'Baseball Field D');

INSERT INTO players (player_name, position, team_id)


VALUES
('Player 1', 'Forward', 1), -- Player 1 on Football Team A
('Player 2', 'Midfielder', 1), -- Player 2 on Football Team A
('Player 3', 'Guard', 2), -- Player 3 on Basketball Team B
('Player 4', 'Center', 2), -- Player 4 on Basketball Team B
('Player 5', 'Striker', 3), -- Player 5 on Tennis Team C
('Player 6', 'Defender', 4); -- Player 6 on Baseball Team D

INSERT INTO events (event_name, event_date, team1_id, team2_id, location)


VALUES
('Football Championship', '2024-06-15', 1, 2, 'Football Stadium A'),
('Basketball Showdown', '2024-07-10', 2, 3, 'Basketball Arena B'),
('Tennis Open Final', '2024-08-01', 3, 4, 'Tennis Court C'),
('Baseball Cup', '2024-09-20', 4, 1, 'Baseball Field D');

INSERT INTO revenues (event_id, revenue_amount)


VALUES
(1, 100000.00), -- Revenue from Football Championship
(2, 75000.00), -- Revenue from Basketball Showdown
(3, 50000.00), -- Revenue from Tennis Open Final
(4, 120000.00); -- Revenue from Baseball Cup

You might also like