![]() The second expression returns true because it matches any string that begins with the letter f and followed by any number of characters.The first expression returns true because the foopattern does not contain any wildcard character so the LIKE operator acts like the equal ( =) operator.See the following example: SELECT 'foo' LIKE 'foo', - true 'foo' LIKE 'f%', - true 'foo' LIKE '_o_', - true 'bar' LIKE 'b_' - false Code language: SQL (Structured Query Language) ( sql ) Let’s take some examples of using the LIKE operator Simple PostgreSQL LIKE examples PostgreSQL LIKE operator – pattern matching examples If the pattern does not contain any wildcard character, the LIKE operator behaves like the equal ( =) operator. ![]() The NOT LIKE operator returns true when the value does not match the pattern. To negate the LIKE operator, you use the NOT operator as follows: value NOT LIKE pattern Code language: SQL (Structured Query Language) ( sql ) The expression returns true if the value matches the pattern. The syntax of PostgreSQL LIKE operator is as follows: value LIKE pattern Code language: SQL (Structured Query Language) ( sql ) Underscore sign ( _) matches any single character. ![]()
0 Comments
Leave a Reply. |