String Functions and Operators

Basic string functions and operators offer a number of capabilities and return string values as their results. Some string functions are dyadic, indicating that they operate on two strings at once. ANSI SQL supports the string functions listed in Table 4-9.

Table 4-9. SQL string functions and operators

Function or operator

Usage

Concatenation operator

Appends two or more literal string expressions, column values, or variables together into one string

CONVERT

Converts a string to a different representation within the same character set

LOWER

Converts a string to all lowercase characters

OVERLAY

Returns the result of replacing a substring of one string with another

SUBSTRING

Returns a portion of a string

TRANSLATE

Converts a string from one character set to another

TRIM

Removes leading characters, trailing characters, or both from a character string

UPPER

Converts a string to all uppercase characters

Get SQL in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.