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β
Parameter | Description |
---|---|
str | Specifies the original string to be judged |
suffix | Specifies 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 |
+-----------------------------------+-----------------------------------+