INET_NTOA | Syntax: | INET_NTOA(Value) | Return value: | CHAR | Function type: | Miscellaneous function | |
|
|
The INET_NTOA() function converts an integer "Value" to an IP address.
If the "Value" argument is invalid, the INET_NTOA() function returns a string containing "0.0.0.0".
If the "Value" argument is too large or NULL, the INET_NTOA() function returns NULL. |
SQL Examples for the INET_NTOA function |
1
2
3
4
5
6
7
8
9
10
11
12
|
|
SELECT INET_NTOA(2130706433);
SELECT INET_NTOA(1123631620);
SELECT INET_NTOA('');
SELECT INET_NTOA(0);
SELECT INET_NTOA(1);
SELECT INET_NTOA('xxx.xxx.xxx.xxx');
SELECT INET_NTOA(52130706433);
SELECT INET_NTOA(null);
|
|
inet_ntoa(2130706433) |
varchar(31) BINARY |
127.0.0.1 |
|
|
inet_ntoa(1123631620) |
varchar(31) BINARY |
66.249.66.4 |
|
|
inet_ntoa('') |
varchar(31) BINARY |
0.0.0.0 |
|
|
INET_NTOA(0) |
varchar(31) BINARY |
0.0.0.0 |
|
|
INET_NTOA(1) |
varchar(31) BINARY |
0.0.0.1 |
|
|
INET_NTOA('xxx.xxx.xxx.xxx') |
varchar(31) BINARY |
0.0.0.0 |
|
|
INET_NTOA(52130706433) |
varchar(31) BINARY |
NULL |
|
|
inet_ntoa(null) |
varchar(31) BINARY |
NULL |
|
|
|
The examples were created with the MyWAY SQL manager: |
How to use the INET_NTOA() function in MySQL and MariaDB databases |
In MySQL and MariaDB the INET_NTOA() function can be used to convert an IPv4 address from its numeric form to its text representation. Te function takes a numeric value as an argument representing the IPv4 address and returns the corresponding IPv4 address in text format, for example for display purposes or to use in queries and comparisons to specific ranges filter or retrieve from IPv4 addresses. The text format is used to perform string operations or to extract specific parts of the address. |
|
Further MySQL und MariaDB SQL Miscellaneous functions |
|