The steps of converting decimal to octal in MySQL
The following talk about MySQL decimal to octal implementation of the steps, the secret of the text is close to the topic. So, gossip will not talk about it, we look directly at the following bar, I believe that after reading MySQL to achieve decimal to octal steps in this article you will benefit.
OCT(N)
where n is the value to be converted. This parameter is a longlong (BIGINT) number
Example 1 -Basic Usage
SELECT OCT(8);
Results:
+--------+| OCT(8) |+--------+| 10 |+--------+
The result is 10 because it is the octal equivalent of 8 in decimal.
Example 2 -Different values
Here is another example of different values:
SELECT OCT(10), OCT(20), OCT(30), OCT(100), OCT(1000);
Results:
+---------+---------+---------+----------+-----------+| OCT(10) | OCT(20) | OCT(30) | OCT(100) | OCT(1000) |+---------+---------+---------+----------+-----------+| 12 | 24 | 36 | 144 | 1750 |+---------+---------+---------+----------+-----------+
Example 3 -Expression
You can also use the following expressions:
SELECT OCT(100 + 2), OCT(100 * 2), OCT(100 / 2), OCT(100 - 2);
Results:
+--------------+--------------+--------------+--------------+| OCT(100 + 2) | OCT(100 * 2) | OCT(100 / 2) | OCT(100 - 2) |+--------------+--------------+--------------+--------------+| 146 | 310 | 62 | 142 |+--------------+--------------+--------------+--------------+
What is octal?
Octal is a base-8 number notation system. This is the opposite of decimal, which is based on 10.
In decimal, we count up to 9 and then add a 0 after the first digit (e.g., 9 is followed by 10, which is 1 plus a 0).
However, in octal (base 8), we only count to 7, then start over and add a 0. So octal 10 and decimal 8 are equivalent.
The table is as follows:
Decimal (radix 10) Octal (radix 8)112
2334455667781091110121113121413151416151716201721182219232024
For the above MySQL implementation decimal to octal steps related to the content, we still do not understand anything? Or if you want to know more about it, you can continue to pay attention to our industry information section.