11 Creating Functions and Procedures

In Chapter 8, you learned how to call built-in MySQL functions; in this chapter, you’ll write your own. You’ll also learn to write procedures and explore the key differences between the two.

You’ll add logic to your functions and procedures using if statements, loops, cursors, and case statements to perform different tasks based on the value of your data. Lastly, you’ll practice accepting values in your functions and procedures and returning values.

Functions vs. Procedures

Functions and procedures are programs you can call by name. Because they’re saved in your MySQL database, they are sometimes called ...

Get MySQL Crash Course now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.