From the course: MySQL Essential Training

Unlock this course with a free trial

Join today to access over 23,700 courses taught by industry experts.

Value functions

Value functions

- [Bill] Hi, I'm Bill Weinman. My SQL provides several functions for constraining the values of numbers. For example, if we want an absolute value, we can say SELECT ABS for absolute value, and I can give it a negative number, say -47, and my result is positive 47. This also works for real numbers, so I can say minus 47.73 and I get positive 47.73. The ABS, or absolute value function, provides the absolute value of a signed number, the result will always be positive. The CEILING function returns the lowest integer value that is not lower than the operand. That may sound a little bit confusing. What it is is specific because that is specifically what this does. If I say CEILING of 12.2, you notice I get 13 because 12 is lower than 12.2, but 13 is not, so the result is 13. The lowest integer value that is not lower than the operand. CEILING also has an alias, just CEIL, C-E-I-L by itself, which gives us the same result. The inverse of CEILING is FLOOR, and so if I say FLOOR of 12.9, you…

Contents