Concept Flow - ABS and MOD
Start with a number
Get absolute value
Return result
ABS returns the positive value of a number. MOD returns the remainder after division.
SELECT ABS(-7) AS abs_val, MOD(17, 5) AS mod_val;
| Step | Function | Input | Calculation | Result |
|---|---|---|---|---|
| 1 | ABS | -7 | Remove negative sign | 7 |
| 2 | MOD | 17, 5 | 17 divided by 5 is 3 remainder 2 | 2 |
| 3 | END | - | All calculations done | Query returns abs_val=7, mod_val=2 |
| Variable | Start | After ABS | After MOD | Final |
|---|---|---|---|---|
| abs_val | -7 | 7 | 7 | 7 |
| mod_val | 17, 5 | 17, 5 | 2 | 2 |
ABS(num): Returns the positive value of num. MOD(num, divisor): Returns remainder of num divided by divisor. Use ABS to remove negative signs. Use MOD to find remainders after division. Both return numeric results.