General Operators

The operators listed here are defined for a number of native data types, ranging from numeric types to data/time types.

Table 4-2. Postgres Operators

OperatorDescriptionUsage
< Less than?1 < 2
<= Less than or equal to?1 <= 2
<> Not equal?1 <> 2
= Equal?1 = 1
> Greater than?2 > 1
>= Greater than or equal to?2 >= 1
|| Concatenate strings'Postgre' || 'SQL'
!!= NOT IN3 !!= i
~~ LIKE'scrappy,marc,hermit' ~~ '%scrappy%'
!~~ NOT LIKE'bruce' !~~ '%al%'
~ Match (regex), case sensitive'thomas' ~ '.*thomas.*'
~* Match (regex), case insensitive'thomas' ~* '.*Thomas.*'
!~ Does not match (regex), case sensitive'thomas' !~ '.*Thomas.*'
!~* Does not match (regex), case insensitive'thomas' !~ '.*vadim.*'