Search code examples
mysqlmysql-workbenchmysql-error-1064

Hi How do i workout this mysql query question


List the course number, the offering number, and the average GPA of students enrolled. Only include courses offered in winter term in which the average GPA of enrolled students is greater than 3.0. Database

Here is the database, if you need anything else let me know I have tried this but can't seem to get anywhere

SELECT O.CourseNo, E.offerNo, S.StdGPA
FROM Offering O JOIN 
Student S JOIN
Enrollment E
WHERE O.OfferNo = E.OfferNo
AND E.stdSSN = S.StdSSN
AND O.OffTerm = "WINTER"
AND S.StdGPA > 3.0;

Solution

  • Try this query.

    SELECT O.CourseNo, E.offerNo, S.StdGPA FROM Offering O INNER JOIN Enrollment E
    ON O.OfferNo = E.OfferNo INNER JOIN Student S
    ON E.stdSSN = S.StdSSN WHERE O.OffTerm = "WINTER" AND S.StdGPA > 3