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

Course Content

Intermediate SQL

Intermediate SQL

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

More Complex Filtering

Previously, the school held a competition for students who took Mathematics, and some of them were rewarded. Now, the school wants to ensure that there are no students who cheat and take more than one exam, including the math exam.

Therefore, the school has asked us to retrieve the last names of those students who took more than one exam, one of which was 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

Here is a preview of the student_grades table we are working with:

Task

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.

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 1. Chapter 8
toggle bottom row

More Complex Filtering

Previously, the school held a competition for students who took Mathematics, and some of them were rewarded. Now, the school wants to ensure that there are no students who cheat and take more than one exam, including the math exam.

Therefore, the school has asked us to retrieve the last names of those students who took more than one exam, one of which was 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

Here is a preview of the student_grades table we are working with:

Task

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.

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 1. Chapter 8
toggle bottom row

More Complex Filtering

Previously, the school held a competition for students who took Mathematics, and some of them were rewarded. Now, the school wants to ensure that there are no students who cheat and take more than one exam, including the math exam.

Therefore, the school has asked us to retrieve the last names of those students who took more than one exam, one of which was 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

Here is a preview of the student_grades table we are working with:

Task

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.

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Previously, the school held a competition for students who took Mathematics, and some of them were rewarded. Now, the school wants to ensure that there are no students who cheat and take more than one exam, including the math exam.

Therefore, the school has asked us to retrieve the last names of those students who took more than one exam, one of which was 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

Here is a preview of the student_grades table we are working with:

Task

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.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 8
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt