🙏 We need your help! SQLtest.online has no ads and lives only on donations. Even a small amount helps. Donate now →
SQL code copied to buffer
Task 32:

Index for the Student Course History

MariaDB
The "My courses" page runs this query for every student:
SELECT section_id, status, final_grade FROM enrollments WHERE student_id = ? ORDER BY enrolled_at;
The task runs on a small copy of enrollments with the primary key enrollment_id.
Create one index that finds the student's enrollments already sorted by enrolled_at. A student has many enrollments. The index name is up to you.
Expected result Columns: 3 · Rows: 2
non_unique index_type key_columns

Write your query below and click "Check it!". Tables are described in the right pane.

Tutorial

By checking a query, you agree that it is stored without your account details and may be included in anonymized datasets, including for AI training. Learn more

The query result will appear here. Ctrl+Enter - Run query