In: Computer Science
CREATE TABLE Player
(
Pid int NOT NULL ,
Date_of_Birth date NOT NULL ,
Position varchar(50) NOT NULL ,
Salary numeric(18,0) NOT NULL ,
Club varchar(50) NOT NULL ,
PRIMARY KEY(Pid),
FOREIGN KEY (Club) REFERENCES Football_Club(Name)
);
CREATE TABLE Football_Club
(
Name varchar(50) NOT NULL ,
City varchar(50) NOT NULL ,
Asset decimal(15,3) NOT NULL ,
Captain int Unique,
PRIMARY KEY(NAME),
FOREIGN KEY (Captain) REFERENCES Player(Pid)
);
CREATE TABLE Stakeholder
(
Name varchar(50) NOT NULL ,
Age numeric(5,0) NOT NULL ,
Percentage_Holding decimal(5,2) NOT NULL ,
Club_Owned varchar(50) NOT NULL ,
PRIMARY KEY(NAME,Club_Owned),
FOREIGN KEY (Club_Owned) REFERENCES Football_Club(Name),
CHECK (Percentage_Holding>0 AND
Percentage_Holding<=100)
);