Skip to main content
Version: Latest-3.5

starts_with

This function returns 1 when a string starts with a specified prefix. Otherwise, it returns 0. When the argument is NULL, the result is NULL.

Syntax​

BOOLEAN starts_with(VARCHAR str, VARCHAR prefix)

Examples​

mysql> select starts_with("hello world","hello");
+-------------------------------------+
|starts_with('hello world', 'hello') |
+-------------------------------------+
| 1 |
+-------------------------------------+

mysql> select starts_with("hello world","world");
+-------------------------------------+
|starts_with('hello world', 'world') |
+-------------------------------------+
| 0 |
+-------------------------------------+

keyword​

START_WITH