What is LTRIM() in SQL?

The LTRIM() function removes the leading space characters from a string.

Figure 1 shows a visual representation of the LTRIM() function.

Figure 1: Visual representation of LTRIM() function

Syntax

LTRIM(string)

Parameter

The LTRIM() function takes a string as a parameter.

Return value

LTRIM() removes the leading space characters from the string sent as a parameter.

Code

The following example shows how to use LTRIM() to remove leading spaces from words.

To see the changes, highlight both the “Educative” strings in the output.

SELECT " Educative" as BeforeLtrim;
SELECT LTRIM(" Educative") as AfterLtrim;

Free Resources