MySQL OCT() function
MySQL OCT() returns octal value of a decimal number.
This function is useful in -
- Octal is a base-8 numbering system that uses digits 0-7, often used in computer systems for its compact representation.
- In Unix and Linux systems, file permissions are often represented in octal format.
- Some database systems, particularly MySQL, use octal numbers to set various flags and modes for operations like file permissions, user privileges, and server modes.
- Octal numbers are used in bitwise operations and manipulation.
- In digital systems and electronics, octal numbers are used to represent groups of three binary digits (bits).
- Octal used to be widely used in early computing systems due to its convenient representation in binary-coded decimal (BCD) form.
|num||A decimal number whose octal representation is to be retrieved.|
MySQL Version: 8.0
Example: OCT() function
The above MySQL statement returns an octal representation of the decimal number 55.
mysql> SELECT OCT('55'); +-----------+ | OCT('55') | +-----------+ | 67 | +-----------+ 1 row in set (0.03 sec)
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join