Tilde (~) operator helps the regular expression to be matched in any part of the string easily. internal Postgres operator for NOT ILIKE (Careful: slightly different operator precedence.) Related Solutions. Tilde regular expressions are more powerful in comparison to LIKE and SIMILAR TO operators. Between (inclusive of the range endpoints). Example (s) datatype BETWEEN datatype AND datatype boolean.
These behave much like operators, but have special syntax mandated by the SQL standard. LIKE operator works best with full strings and if a substring or a small part within a string needs to be matched then in that case the pattern must contain (%) at the beginning of substring and at the end of substring as well. There are also some comparison predicates, as shown in Table 9.2. Underscore (_) in above example basically looks for only single character match and percentage (%) looks for none, single or multiple characters match.
In the above examples you see, the literal pattern, without percentage and underscore signs, means the string itself would be considered as a pattern and it’s working like and equal sign and matches input letter by letter.