Categories:

String & Binary Functions (Matching/Comparison)

STARTSWITH

Returns true if expr1 starts with expr2. Both expressions must be text or binary expressions.

Syntax

STARTSWITH( <expr1> , <expr2> )

Collation Details

The collation specifications of all input arguments must be compatible.

This function does not work with the following collation specifications:

  • lower

  • upper

  • cs-ai (case-sensitive, accent-insensitive)

Examples

select * from strings;

---------+
    S    |
---------+
 coffee  |
 ice tea |
 latte   |
 tea     |
 [NULL]  |
---------+

select * from strings where startswith(s, 'te');

-----+
  S  |
-----+
 tea |
-----+