This section contains reference documentation for the isSubnetOf function.
Takes 2 arguments of type STRING. The first argument is an ipPrefix, and the second argument is a single ipAddress. This function handles both IPv4 and IPv6 arguments.
Returns a boolean value checking if ipAddress is in the subnet of ipPrefix
Signatures
isSubnetOf(ipPrefix, ipAddress) -> boolean
Usage Examples
See the following sample queries where isSubnetOf is used in different parts of the query.
SELECT isSubnetOf('192.168.0.1/24', '192.168.0.225') AS resultFROM myTable;---> returns trueSELECT isSubnetOf('1.2.3.128/26', '1.2.5.1') AS resultFROM myTable;---> returns false
SELECTcount(*) FROM myTable WHERE isSubnetOf('192.168.0.1/24', ipAddressCol);SELECTcount(*) FROM myTable WHERE isSubnetOf('192.168.0.1/24', ipAddressCol) OR isSubnetOf(ipPrefixCol, '7890:db8:113::8a2e:370:7336');