I am designing a database project that holds records for an alumni association. My goal was to make sure that the names in the awards table only come from those who have been nominated in the alumni table (where Award_Nominated acts as a Boolean). I have tried using two booleans, one for nomination and another for winning, but that still leaves a possibility for a logical error, i.e. one can be an award winner without getting nominated. My question is how can I make sure that the award winner names only come from the alumni name values with Award_nominated as true.
The relevant tables are declared below:
CREATE TABLE Alumni
(
Alumni_ID int NOT NULL IDENTITY(1,1),
First_Name varchar(20) UNIQUE NOT NULL,
Last_Name varchar(20) UNIQUE NOT NULL,
Graduation_Year int NOT NULL,
Course_taken varchar(255) NOT NULL,
Award_Nominated bit,
Phone_Number int NOT NULL,
Email_Address varchar(255) NOT NULL,
PRIMARY KEY (Alumni_ID, First_Name, Last_Name)
);
CREATE TABLE Awards
(
Award_year int NOT NULL,
Chapters varchar(255),
Award_Winner_First_Name varchar(20) NOT NULL,
Award_Winner_Last_Name varchar(20) NOT NULL,
FOREIGN KEY (Award_Winner_First_Name) REFERENCES Alumni(First_Name),
FOREIGN KEY (Award_Winner_Last_Name) REFERENCES Alumni(Last_Name),
Award_purpose varchar(255) NOT NULL
);
Alumnitable has a design problem, because the first and last name columns should not be unique.