INET4
IPv4 address data type. Stores IPv4 addresses as 4-byte binary strings for efficient storage and retrieval.
Syntax
INET4Description
Examples
CREATE OR REPLACE TABLE t1 (a INET4);
INSERT INTO t1 VALUES('0.0.0.0'), ('255.10.0.0'), ('255.255.255.255');
INSERT INTO t1 VALUES (0xa0000001);
INSERT INTO t1 VALUES (0xf0000000);
INSERT INTO t1 VALUES (0xff000001);
SELECT HEX(a), a FROM t1 ORDER BY a;
+----------+-----------------+
| HEX(a) | a |
+----------+-----------------+
| 00000000 | 0.0.0.0 |
| A0000001 | 160.0.0.1 |
| F0000000 | 240.0.0.0 |
| FF000001 | 255.0.0.1 |
| FF0A0000 | 255.10.0.0 |
| FFFFFFFF | 255.255.255.255 |
+----------+-----------------+Last updated
Was this helpful?

