Person Name ID Address DOB Instructor InstructorID Rank Sal
-Person (Name, ID, Address, DOB)
- Instructor (InstructorID, Rank, Salary)
- Student (StudentID, Classification, GPA, MentorID, CreditHours)
-Course (CourseCode, CourseName, PreReq)
-Offering (CourseCode, SectionNo, InstructorID)
- Enrollment (CourseCode, SectionNo, StudentID, Grade)
Note:PreReq=Pre-Requirest
From the SQL tables commands above,use the English statement below the write SQL statements:-
Delete the records of students from the database who have a GPA less than 0.5. Note that it is not sufficient to delete these records from Student table; you have to delete them from the Enrollment table first.On the other hand, do not delete these students from the Person table.
Solution
SQL query:
Delete the records of students from the database who have a GPA less than 0.5.
First delete from enrollment table then from student table.
DELETE from Enrollment where StudentID in (select StudentID from Student where GPA < 0.5);
DELETE from Student where GPA < 0.5;
