INET Functions & Operators

These apply to MonetDB SQL type: inet (IPv4 Network Address).

An IPv4 Network Address string has a specific syntax, see also IPv4 address.

OperatorDescriptionExampleResult
<is less thaninet '192.168.1.5' < inet '192.168.1.6'true
<=is less than or equalinet '192.168.1.5' <= inet '192.168.1.5'true
=equalsinet '192.168.1.5' = inet '192.168.1.5'true
>is greater thaninet '192.168.1.5' > inet '192.168.1.4'true
>=is greater than or equalinet '192.168.1.5' >= inet '192.168.1.5'true
<>is not equalinet '192.168.1.5' <> inet '192.168.1.4'true
<<is contained byinet '192.168.1.5' << inet '192.168.1/24'true
<<=is contained by or equalsinet '192.168.1/24' <<= inet '192.168.1/24'true
>>containsinet '192.168.1/24' >> inet '192.168.1.5'true
>>=contains or equalsinet '192.168.1/24' >>= inet '192.168.1/24'true

Inet functions

Note: You must include the sys. prefix for all these inet functions (see examples) in order to work properly from other schemas than sys.

FunctionReturn typeDescriptionExampleResult
sys.abbrev(inet)clobabbreviated display format as textsys.abbrev(inet '10.1.0.0/16')10.1/16
sys.broadcast(inet)inetbroadcast address for networksys.broadcast(inet '192.168.1.5/24')192.168.1.255/24
sys.host(inet)clobextract IP address as textsys.host(inet '192.168.1.5/24')192.168.1.5
sys.hostmask(inet)inetconstruct host mask for networksys.hostmask(inet '192.168.23.20/30')0.0.0.3
sys.left_shift(inet, inet)booleanis contained bysys.left_shift(inet '192.168.1/24', inet '192.168.1.5')true
sys.left_shift_assign(inet, inet)booleanis contained by or equalssys.left_shift_assign(inet '192.168.1/24', inet '192.168.1/24')true
sys.masklen(inet)intextract netmask lengthsys.masklen(inet '192.168.1.5/24')24
sys.netmask(inet)inetconstruct netmask for networksys.netmask(inet '192.168.1.5/24')255.255.255.0
sys.network(inet)inetextract network part of addresssys.network(inet '192.168.1.5/24')192.168.1.0/24
sys.right_shift(inet, inet)booleancontainssys.right_shift(inet '192.168.1/24', inet '192.168.1.5')true
sys.right_shift_assign(inet, inet)booleancontains or equalssys.right_shift_assign(inet '192.168.1/24', inet '192.168.1/24')true
sys.setmasklen(inet, int)inetset netmask length for inet valuesys.setmasklen(inet '192.168.1.5/24', 16)192.168.1.5/16
sys.text(inet)clobextract IP address and netmask length as textsys.text(inet '192.168.1.5')192.168.1.5/32