INET_ATON | Syntax: | INET_ATON(String) | Return value: | INTEGER | Function type: | Miscellaneous function | |
|
|
The INET_ATON() function returns an integer representing the numeric value of the IP address in "String".
If the value of "String" is invalid or NULL, the INET_ATON() function returns NULL. |
SQL Examples for the INET_ATON function |
|
SELECT INET_ATON('127.0.0.1');
SELECT INET_ATON('66.249.66.4');
SELECT INET_ATON('257.0.0.1');
SELECT INET_ATON('');
SELECT INET_ATON(null);
|
|
inet_aton('127.0.0.1') |
bigint(21) |
2130706433 |
|
|
inet_aton('66.249.66.4') |
bigint(21) |
1123631620 |
|
|
inet_aton('257.0.0.1') |
bigint(21) |
NULL |
|
|
inet_aton('') |
bigint(21) |
NULL |
|
|
inet_aton(null) |
bigint(21) |
NULL |
|
|
|
The examples were created with the MyWAY SQL manager: |
How to use the INET_ATON() function in MySQL and MariaDB databases |
The INET_ATON() function in MySQL and MariaDB is used to convert an IPv4 address from its text representation to its numeric form. The function takes an IPv4 address in its text format as an argument and returns an integer value representing the numeric value of the IPv4 address, suitable for storage in a binary table columns or in comparisons or queries to filter or retrieve specific ranges of IPv4 addresses can be used. By converting IPv4 addresses to their numeric form, calculations or operations can be performed on them, for example to create subnets or extract certain parts of the address. |
|
Further MySQL und MariaDB SQL Miscellaneous functions |
|