I have 2 tables one named Students and one named Grades and I'm trying to add a foreign key constraint to the Grades table so that if someone is deleted from the Students table all of their grades will be deleted as well. I have a column named TNumber to match the 2. Here's my code so far.
ALTER TABLE Grades
ADD CONSTRAINT fk_Grades
FOREIGN KEY (TNumber)
REFERENCES Students(TNumber) ON DELETE CASCADE;
The problem is that the code runs but it doesn't create the foreign key. Could someone just look at it and see if I'm doing something wrong in my syntax because the code runs and doesn't throw any errors.