A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/like_all below:

Website Navigation


LIKE ALL | Snowflake Documentation

LIKE ALL

Performs a case-sensitive comparison to match a string against all of one or more specified patterns. Use this function in a WHERE clause to filter for matches.

Tip

You can use the search optimization service to improve the performance of queries that call this function. For details, see Search Optimization Service.

See also:

[ NOT ] LIKE

Syntax
<subject> LIKE ALL (<pattern1> [, <pattern2> ... ] ) [ ESCAPE <escape_char> ]

Copy

Arguments

Required:

subject

The string to compare to the pattern(s).

pattern#

The pattern(s) that the string is to be compared to. You must specify at least one pattern.

Optional:

escape_char

Character(s) inserted in front of a wildcard character to indicate that the wildcard should be interpreted as a regular character rather than as a wildcard.

Returns

Returns a BOOLEAN or NULL. The value is TRUE if there is a match. Otherwise, returns FALSE. Returns NULL if any argument is NULL.

Usage notes Collation details

Only the upper, lower, and trim collation specifications are supported. Combinations with upper, lower, and trim are also supported (for example, upper-trim and lower-trim), except for locale combinations (for example, en-upper).

Examples

Create a table that contains some strings:

CREATE OR REPLACE TABLE like_all_example(name VARCHAR(20));
INSERT INTO like_all_example VALUES
    ('John  Dddoe'),
    ('Joe   Doe'),
    ('John_do%wn'),
    ('Joe down'),
    ('Tom   Doe'),
    ('Tim down'),
    (null);

Copy

This query shows how to use patterns with wildcards (%) to find matches:

SELECT * 
  FROM like_all_example 
  WHERE name LIKE ALL ('%Jo%oe%','J%e')
  ORDER BY name;

Copy

+-------------+                                                                 
| NAME        |
|-------------|
| Joe   Doe   |
| John  Dddoe |
+-------------+

This query shows that all patterns need to match for a successful result:

SELECT * 
  FROM like_all_example 
  WHERE name LIKE ALL ('%Jo%oe%','J%n')
  ORDER BY name;

Copy

+------+                                                                        
| NAME |
|------|
+------+

This query shows how to use an escape character to indicate that characters that are usually wild cards (_ and %) should be treated as literals.

SELECT * 
  FROM like_all_example 
  WHERE name LIKE ALL ('%J%h%^_do%', 'J%^%wn') ESCAPE '^'
  ORDER BY name;

Copy

+------------+                                                                  
| NAME       |
|------------|
| John_do%wn |
+------------+

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4