INET¶
The INET data type in SQL is used to store IPv4 and IPv6 addresses. These addresses can be compared, filtered, and sorted using standard SQL operations.
Here's an example of how to create a table, insert data, and query data using the INET data type:
Creating a table with an INET column¶
To create a table with an INET column, use the following SQL syntax:
Inserting data into the INET column¶
To insert data into the INET column, provide the IP addresses as strings or integers:
Querying data from the INET column¶
To query data from the INET column, use standard SQL syntax:
This query will return the following result:
Filtering data using the INET column¶
You can filter data using the INET column with standard SQL operators:
This query will return the following result:
Querying for specific IP addresses¶
To query for specific IP addresses, use the following syntax:
This query will return the following result: