Skip to main content

ENDS_WITH

Description​

Returns true if the string ends with the specified suffix, otherwise returns false. Special cases:

  • If either of the two parameters is NULL, returns NULL.

Syntax​

ENDS_WITH ( <str> , <suffix> )

Parameters​

ParameterDescription
strSpecifies the original string to be judged
suffixSpecifies the ending string to be judged

Return value​

true or false, type is BOOLEAN. Special cases:

  • If either of the two parameters is NULL, returns NULL.

Example​

SELECT ENDS_WITH("Hello doris", "doris"),ENDS_WITH("Hello doris", "Hello")
+-----------------------------------+-----------------------------------+
| ends_with('Hello doris', 'doris') | ends_with('Hello doris', 'Hello') |
+-----------------------------------+-----------------------------------+
| 1 | 0 |
+-----------------------------------+-----------------------------------+