starts_with Function
The starts_with function indicates whether or not the source string begins with the search string.
Syntax
returnvalue starts_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 begins 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-47 starts_with Function
In this example, the firstname field values that starts with the string "Pe" is indicated as true.
SELECT firstname, starts_with(firstname,"Pe") FROM users
Output: +-----------+----------+
| firstname | Column_2 |
+-----------+----------+
| John | false |
| Peter | true |
| Mary | false |
+-----------+----------+