Last active
September 1, 2020 06:16
-
-
Save gbarreiro/cafaf66fcef8c0d4f72026b6f05f75dd to your computer and use it in GitHub Desktop.
MySQL cheatsheet: flow control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- if-else | |
IF boolean_condition THEN | |
-- ... instructions ... | |
[ELSEIF boolean_condition THEN] | |
-- ... instructions ... | |
ELSE | |
-- ... instructions ... | |
END IF | |
-- normal loop | |
LOOP | |
-- ... instructions ... | |
LEAVE; -- it's really important to leave the loop, if not, it'll run forever | |
END LOOP; | |
-- while loop | |
WHILE boolean_condition DO | |
-- ... instructions ... | |
END WHILE; | |
-- do-while loop | |
REPEAT | |
-- ... instructions ... | |
UNTIL boolean_condition; | |
END REPEAT; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment