jeudi 23 juin 2016

My queries aren't working

enter image description here

Hey everyone I'm trying to do these 2 queries but I can't seem to get them right. I'm not sure what I'm doing wrong, can anyone help me?

a. List all results for all students from the Faculty of Business. The query result will display SID, Name, Faculty, Year, Term, UnitCode, Grade

What I have so far:

SELECT 
    Student.SID, 
    Student.Name,
    Student.Faculty,
    Result.Year,
    Result.Term,
    Result.UnitCode,
    Result.Grade
FROM Result, Student
WHERE Student.Faculty = 'Business'

When this executes it prints repeating data, how can I fix this?

b. List all the results of all students group by Year, Term and UnitCode. The query result will display SID, Name, Faculty, Year, Term, UnitCode, Grade.
What I've got so far:

SELECT
    Student.SID,
    Student.Name,
    Student.Faculty,
    Result.Year,
    Result.Term,
    Result.UnitCode,
    Result.Grade
FROM Result, Student
GROUP BY Result.Year, Result.Term, Result.UnitCode

Aucun commentaire:

Enregistrer un commentaire