Cursor
A cursor walks a SELECT row by row inside a stored program. DECLARE cur CURSOR FOR SELECT …; OPEN; FETCH; CLOSE. Use it when set-based SQL cannot express the loop. Most student problems should stay set-based: UPDATE … WHERE, not a cursor.
Handlers needed for NOT FOUND. Easy to write slow row-by-row logic.
Trap — cursor as the first answer for ‘print all students’ — that’s just SELECT.
On the example next to this theory: Cursor: create two demo rows, then SELECT qty >= 2 ordered. Say which labels come back.
Exam tip
Cursors are for procedures. Prefer UPDATE/SELECT sets.