ends_with Function

The ends_with function indicates whether or not the source string ends with the search string.

Syntax

returnvalue ends_with(source, search_string)

source ::= any*
search_string ::= any*
returnvalue ::= boolean

Semantics

source

The input string to be searched. This argument is implicitly cast to a sequence of strings.

search_string

The string that should be searched in the source. This argument is implicitly cast to a sequence of strings.

returnvalue

Returns true if source ends with search_string else returns false.

Returns false if any argument is an empty sequence or a sequence with more than one item.

Returns NULL if source or search_string is NULL.

Example 12-17 ends_with Function

In this example, the firstname field values that ends with the string "hn" is indicated as true.

SELECT firstname, ends_with(firstname,"hn") FROM users;
 +-----------+----------+
 | firstname | Column_2 |
 +-----------+----------+
 | John      | true     |
 | Peter     | false    |
 | Mary      | false    |
 +-----------+----------+