Here is the query that I can not figure out how to do : “execute an SQL query that selects names of seniors, names of their mentors, and GPA in descending order of GPA-values.” The tables of my database are as follows:
Person (Name, ID, Address, DateOfBirth)
Instructor (InstructorID, Rank, Salary)
Student (StudentID, Classification, GPA, MentorID, CreditHours)
Other information that might be useful: The classification is a string, “Freshman” ect. The ID in Person is liked to the InstructorID and StudentID in their tables. Both instructors and students are in the person table. Students and Instructors can both be mentors(im not sure this matters). If you need any other information, let me know! Thanks!
Assuming I understand you…[1]
The Break-down:
INNER JOIN Person AS SeniorDetailsINNER JOINtells sql it MUST have a matchASis to rename the person table (we need to since the Person table actually referenced twice in two separate joins)INNER JOIN Person AS MentorDetailsWHERE Student.Classification = 'Senior'ORDER BY Student.GPA[1] The above answer is judged solely on the information I could attain from this revision. If I don’t get around to updating my answer for later revisions, please don’t kill me.