Try Opteryx

IP contains

Returns true when the network on the left, in CIDR notation, contains the IPv4 address on the right, for example '10.0.0.0/8' >>= ip. The mirror of <<=.

Category: comparison

SQL symbol: >>=

Syntax

<network> >>= <address>

Parameters

  • <network> — The network to test against, in CIDR notation, with its prefix length. Accepts varchar.
  • <address> — An IPv4 address. It is held as its 32-bit integer value, which is why the signature below reads INTEGER. Accepts integer.

Returns

boolean

Examples

SELECT '10.0.0.0/8' >>= CAST('10.0.0.1' AS IPV4);
true

Signatures

  • varchar >>= integer → boolean

Notes

Spelling follows PostgreSQL, CockroachDB and DuckDB's inet extension.

See Also