From the course: MySQL Essential Training (2019)
Unlock this course with a free trial
Join today to access over 22,400 courses taught by industry experts.
Numeric conversions - MySQL Tutorial
From the course: MySQL Essential Training (2019)
Numeric conversions
- [Instructor] Numeric values are normally expressed in decimal base 10 using Arabic numerals. If you want to express values in other systems, you may convert the number using one of these functions. So if I say select 32742 and execute, you notice I get the result here, that says 32742, but I if I say HEX of 32742 and execute, it's now displayed in base 16 HEX decimal using a combination of letters and numbers. If I want octal instead of HEX decimal, I use the OCT function and that will give me 7746, remember octal is base eight, which means there are no numbers higher than the number seven, and if I want to express it in binary, I can say BIN, and execute, and now I get that in binary, which is all those ones and zeroes. The convert function CONV will convert between different bases, so if I say convert this from base 10 to base 16, like that, then I get that 7FE6 result, just as we did with the HEX function or if I want to, I can convert it back, I can say, in quotes, 7FE6, and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.