More Complex Filtering
The school recently held a competition for students who participated in Mathematics. Some students were rewarded, but now the school wants to ensure no students cheated by taking more than one exam, including the math exam.
Your task is to find the last names of students who took more than one exam, with one of them being Mathematics.
Here is the query from our previous assignment that you can use as an example:
1234SELECT student_surname, AVG(grade) as average_grade FROM student_grades GROUP BY student_surname HAVING COUNT(grade) > 1
Swipe to start coding
Retrieve the last names of those students who received more than one grade for the Mathematics exam.
Note
Retrieve only the
surnameof these students. The answer should have only one column.
Brief Instructions
- Retrieve the
student_surnamecolumn. - Use the
WHEREclause to setsubject_name = 'Mathematics'. - Group the results by
student_surname. - Use the
HAVINGclause withCOUNT(grade) > 1.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you help me modify the query to find students who took Mathematics and at least one other exam?
What should the output look like for this new query?
Can you explain how to join the necessary tables if there are multiple exam subjects?
Awesome!
Completion rate improved to 4
More Complex Filtering
Swipe to show menu
The school recently held a competition for students who participated in Mathematics. Some students were rewarded, but now the school wants to ensure no students cheated by taking more than one exam, including the math exam.
Your task is to find the last names of students who took more than one exam, with one of them being Mathematics.
Here is the query from our previous assignment that you can use as an example:
1234SELECT student_surname, AVG(grade) as average_grade FROM student_grades GROUP BY student_surname HAVING COUNT(grade) > 1
Swipe to start coding
Retrieve the last names of those students who received more than one grade for the Mathematics exam.
Note
Retrieve only the
surnameof these students. The answer should have only one column.
Brief Instructions
- Retrieve the
student_surnamecolumn. - Use the
WHEREclause to setsubject_name = 'Mathematics'. - Group the results by
student_surname. - Use the
HAVINGclause withCOUNT(grade) > 1.
Solution
Thanks for your feedback!
single