Skip to content
SQL

String Functions API Reference

SQL string functions for concatenation, extraction and transformation.

By EZ4Code Team

String Functions

Standard SQL string functions (MySQL / PostgreSQL compatible unless noted).

CONCAT(str1, str2, ...)

Concatenate strings. NULL arguments are ignored (MySQL) or propagate (ANSI).

Returns: string

SUBSTRING(str FROM pos FOR len)

Return a substring starting at position pos (1-based) of length len. Also written SUBSTR.

Returns: string

LENGTH(str)

Return the length of the string in characters (CHAR_LENGTH) or bytes (OCTET_LENGTH in MySQL).

Returns: int

UPPER(str)

Convert the string to uppercase.

Returns: string

LOWER(str)

Convert the string to lowercase.

Returns: string

REPLACE(str, from_str, to_str)

Return str with all occurrences of from_str replaced by to_str.

Returns: string

TRIM([LEADING|TRAILING|BOTH] [chars] FROM str)

Remove leading and/or trailing characters from str. Default removes spaces from both ends.

Returns: string

LEFT(str, n)

Return the leftmost n characters of str. (MySQL / SQL Server / PostgreSQL.)

Returns: string

RIGHT(str, n)

Return the rightmost n characters of str. (MySQL / SQL Server / PostgreSQL.)

Returns: string

CHARINDEX(substr, str)

Return the 1-based starting position of substr in str, or 0 if not found. (SQL Server; LOCATE/INSTR in MySQL/PostgreSQL.)

Returns: int

More SQL API References