Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære More Complex Filtering | Grouping
Intermediate SQL
course content

Kursusindhold

Intermediate SQL

Intermediate SQL

1. Grouping
2. Nested Subqueries
3. Joining Tables
4. DDL and DML in SQL

book
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:

1234
SELECT student_surname, AVG(grade) as average_grade FROM student_grades GROUP BY student_surname HAVING COUNT(grade) > 1
copy
Opgave

Swipe to start coding

Retrieve the last names of those students who received more than one grade and one of the subjects they took was Mathematics.

Note

Retrieve only the surname of these students. The answer should have only one column.

Brief Instructions

  • Retrieve the student_surname column.
  • Use the WHERE clause to set subject_name = 'Mathematics'.
  • Group the results by student_surname.
  • Use the HAVING clause with COUNT(grade) > 1.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 8
toggle bottom row

book
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:

1234
SELECT student_surname, AVG(grade) as average_grade FROM student_grades GROUP BY student_surname HAVING COUNT(grade) > 1
copy
Opgave

Swipe to start coding

Retrieve the last names of those students who received more than one grade and one of the subjects they took was Mathematics.

Note

Retrieve only the surname of these students. The answer should have only one column.

Brief Instructions

  • Retrieve the student_surname column.
  • Use the WHERE clause to set subject_name = 'Mathematics'.
  • Group the results by student_surname.
  • Use the HAVING clause with COUNT(grade) > 1.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 8
Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Vi beklager, at noget gik galt. Hvad skete der?
some-alt