Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

sql
mysql
trim
communitycreator

What is LTRIM() in SQL?

Harris Amjad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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;

RELATED TAGS

sql
mysql
trim
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring