Skip to Main Content
Learn SQL using MySQL in One Day and Learn It Well
book

Learn SQL using MySQL in One Day and Learn It Well

by Jamie Chan
April 2024
Intermediate to advanced content levelIntermediate to advanced
127 pages
2h 29m
English
Packt Publishing
Content preview from Learn SQL using MySQL in One Day and Learn It Well

Chapter 11: Control Flow Tools

 

Now that we know how to write basic stored routines, let us move on to a slightly more advanced concept.

 

In the previous chapter, we looked at a simple function for calculating the bonuses of employees. What if we want to perform more complex calculations?

 

For instance, suppose we want to pay 2 months bonus for employees with salary below 3000, but 1 month bonus for employees with salary above that?

 

In order to achieve the above, we need to use control flow tools. These include IF, CASE, and LOOP statements.

 

In this chapter, we’ll be using a lot of examples to illustrate the concepts discussed. For each example, I’ll leave a line before and after the control flow statements so that you can see clearly ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

MySQL Crash Course

MySQL Crash Course

Rick Silva

Publisher Resources

ISBN: 9781836205678Supplemental Content