12th September 2019: PostgreSQL 12 Beta 4 Released!
Unsupported versions: 6.5
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the supported versions listed above instead.

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

Operator Description Usage
< 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 IN 3 !!= 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.*'