February 2025
Beginner
304 pages
8h 8m
English
In chapter 21, we explored making decisions in queries and learned how to make conditional evaluations. Using IF and THEN keywords allowed us to evaluate one or more values and then decide whether to do something else, such as insert a row of values into a table.
In this chapter, we’ll look at other ways to evaluate data and make decisions in SQL, focusing primarily on cursors. Cursors enable us to evaluate a set of data one row or value at a time. Also, as we’ll see, they have a bit of complexity, and there are important considerations regarding their use.
The use of cursors in MySQL is restricted to database objects containing prepared SQL, such as stored procedures. Because of this restriction, we’ll look at some previously ...