Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The steps of converting decimal to octal in MySQL

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report