[Table relationships][1]
Here are the screenshots of my database.
I want to delete all the data from the Student
table using the Student_grade
table where Grade='FAIL'
.
ALL the information of the failed students should be deleted from the database.
Delete from Student
where Student_ID IN (Select Student_ID
from Student_Grade
where Grade = 'FAIL');
Tried this but it's not working. I think data should be deleted from both tables at once because when it deletes from one Student
table there is no references for FK in student_grade
table.
Please can anyone provide the SQL Server query to do this?