There are several different MySQL keywords to control the flow of queries:
- IF: Returns a value if the condition is TRUE and another value if it's FALSE.
- CASE: Goes through conditions and then returns a value once the condition is met. This is like an expanded IF function (IF-THEN-ELSE).
- LOOP: Executes a statement repeatedly. If you don't specifically terminate this, it can run infinitely.
- REPEAT: Repeats a statement until a condition is true. It always runs at least once.
- WHILE: Repeats a statement while a condition is true.
- ITERATE: Starts the statement again. It can appear in LOOP, REPEAT, or WHILE statements.
- LEAVE: Exits the statement. It can appear in LOOP, REPEAT, or ...