New course! Every coder should learn Generative AI!
Try a free lesson+ 1
https://dev.mysql.com/doc/refman/5.7/en/cursors.html
You normally declare a cursor for a select, then you open it, then define a loop. Inside the loop, you iterate (fetch) over every return that is returned by the select, until no more records are left, moment in which you leave the loop. Finally, you close the cursor.