Loading problem...
An academic analytics system needs to identify students who achieved strict excellence across their entire major curriculum.
You are given three tables:
students
courses
enrollments
Task: Return student_id values for students who satisfy both rules:
Important clarifications:
Output requirements:
Supported submission environments:
students:
| student_id | name | major |
|------------|---------|------------------|
| 1 | Alice | Computer Science |
| 2 | Bob | Computer Science |
| 3 | Charlie | Mathematics |
| 4 | David | Mathematics |
courses:
| course_id | name | credits | major |
|-----------|-----------------|---------|------------------|
| 101 | Algorithms | 3 | Computer Science |
| 102 | Data Structures | 3 | Computer Science |
| 103 | Calculus | 4 | Mathematics |
| 104 | Linear Algebra | 4 | Mathematics |
enrollments:
| student_id | course_id | semester | grade |
|------------|-----------|-----------|-------|
| 1 | 101 | 2023-Fall | A |
| 1 | 102 | 2023-Fall | A |
| 2 | 101 | 2023-Fall | B |
| 2 | 102 | 2023-Fall | A |
| 3 | 103 | 2023-Fall | A |
| 3 | 104 | 2023-Fall | A |
| 4 | 103 | 2023-Fall | A |
| 4 | 104 | 2023-Fall | B |[
{"student_id":1},
{"student_id":3}
]Students 1 and 3 cover every required major course and have only A grades on those required-course attempts.
students:
| student_id | name | major |
|------------|------|---------|
| 10 | Eva | Physics |
courses:
| course_id | name | credits | major |
|-----------|----------------|---------|---------|
| 201 | Mechanics | 4 | Physics |
| 202 | Thermodynamics | 4 | Physics |
enrollments:
| student_id | course_id | semester | grade |
|------------|-----------|-------------|-------|
| 10 | 201 | 2024-Spring | A |[]Student 10 is missing required course 202, so the student does not qualify.
students:
| student_id | name | major |
|------------|------|---------|
| 20 | Noor | Biology |
courses:
| course_id | name | credits | major |
|-----------|----------|---------|---------|
| 301 | Genetics | 3 | Biology |
| 302 | Ecology | 3 | Biology |
enrollments:
| student_id | course_id | semester | grade |
|------------|-----------|-------------|-------|
| 20 | 301 | 2023-Fall | A |
| 20 | 301 | 2024-Spring | B |
| 20 | 302 | 2024-Spring | A |[]A non-A retake on required course 301 disqualifies the student.
Constraints