Problem: Build a Mini Dashboard

Write a query that:

  • Joins the students and grades tables.

  • Filters to include only scores greater than 90.

  • Groups results by student.

  • Counts how many high scores (above 90) each student has.

  • Only includes students who scored above 90 in at least one subject.

  • Displays the student’s name and number of high scores.

  • Orders the results by high score count descending.

The students table

ID

Name

1

Ali

2

Fatima

3

Omar

The grades table

ID

Student ID

Subject

Score

1

1

Math

87.5

2

1

History

80.0

3

2

Math

91.0

Problem: Build a Mini Dashboard

Write a query that:

  • Joins the students and grades tables.

  • Filters to include only scores greater than 90.

  • Groups results by student.

  • Counts how many high scores (above 90) each student has.

  • Only includes students who scored above 90 in at least one subject.

  • Displays the student’s name and number of high scores.

  • Orders the results by high score count descending.

The students table

ID

Name

1

Ali

2

Fatima

3

Omar

The grades table

ID

Student ID

Subject

Score

1

1

Math

87.5

2

1

History

80.0

3

2

Math

91.0

MySQL
# Write your quer here: