I've been instructed "not to bother with LIKE
" and use ~
instead. What is wrong with LIKE
and how is ~
different?
Does ~
have a name in this context or do people say "use the tilde operator"?
~
is the regular expression operator, and has the capabilities implied by that. You can specify a full range of regular expression wildcards and quantifiers; see the documentation for details. It is certainly more powerful than LIKE
, but should only be used when that power is needed.
Note that LIKE
is defined in the SQL standard, whereas ~
is a Postgres-specific operator.