Ipv4 Addresses on MySQL

Did You know that you can store ip addresses on mysql with no string handling? Well, I did not.

1
2
INSERT INTO ip_table ('ipv4') VALUES (INET_ATON("127.0.0.1"));
SELECT INET_NTOA('ipv4') FROM ip_table;

Well this does the trick, INET_ATON and INET_NTOA function transforms the ip address into his numeric value(Integer) and vice versa.

el_avena Off…