totn MySQL Functions

MySQL: LTRIM Function

This MySQL tutorial explains how to use the MySQL LTRIM function with syntax and examples.

Description

The MySQL LTRIM function removes all space characters from the left-hand side of a string.

Syntax

The syntax for the LTRIM function in MySQL is:

LTRIM( string )

Parameters or Arguments

string
The string to trim the space characters from the left-hand side.

Applies To

The LTRIM function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

Example

Let's look at some MySQL LTRIM function examples and explore how to use the LTRIM function in MySQL.

For example:

mysql> SELECT LTRIM('   Tech on the net');
Result: 'Tech on the net'

mysql> SELECT LTRIM('   Tech   on   the   net   ');
Result: 'Tech   on   the   net   '

mysql> SELECT LTRIM('    techonthenet.com');
Result: 'techonthenet.com'