Name
INET_ATON()
Synopsis
INET_ATON(IP_address
)
This function converts an Internet Protocol (IP) address in dot-quad notation to its numeric equivalent. The function INET_NTOA() can be used to reverse the results. Here is an example:
SELECT INET_ATON('12.127.17.72') AS 'AT&T'; +-----------+ | AT&T | +-----------+ | 209654088 | +-----------+
This function is useful in sorting IP addresses that lexically
might not sort properly. For instance, an address of 10.0.11.1 would
come after 10.0.1.1 and before 10.0.2.1 under normal sort conditions
in an ORDER BY
clause.
Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.