SQL String Functions

SQL provides us with a number of tools that give us the ability to manipulate string values. This section of the site gives details of the various functions available and demonstrates real world examples of their use.

The syntax of the string functions can vary for different database systems. For example both Oracle and SQL Server have a string function that can extract a specified section of a string. In Oracle and Microsoft Access this function is called SUBSTR, in SQL Server it is called SUBSTRING. These pages give details of the differing naming conventions / syntax for the different databases of SQL Server, Oracle, Microsoft Access and MySQL.

For a more detailed article on each of the string functions please click the Function names below.

Many string functions are used in combination with other string functions to achieve a desired solution to a problem.

 

SQL String Functions

  • SQL CONCATENATE (appending strings to one another)

    SQL allows us to concatenate strings but the syntax varies according to which database system you are using. Concatenation can be used to join strings from different sources...

  • SQL Coalesce function - how to use it with examples

    The SQL Coalesce function returns the value of the first of its input parameters that is not NULL. Although it can be used with strings, COALESCE it is not limited to being passed just strings.

  • SQL TRIM Functions, purpose, syntax and common uses

    This article demonstrates how to remove white spaces from the beginning and end of string variables using SQL TRIM / LTRIM / RTRIM functions.

  • SQL Replace Function, purpose, syntax and common uses

    The article explains the functionality, syntax and common uses of the SQL Replace function. The SQL Replace function enables us to look for a certain character phrase in a string and replace it with another character phrase.

  • SQL Substring Function

    The SQL Substring function enables us to extract a section of a string. The syntax of this function (and even its name) varies depending on which database you are using.