Skip to content
Related Articles

Related Articles

Improve Article
LPAD, LOWER and LTRIM Function in MariaDB
  • Last Updated : 09 Oct, 2020

1. LPAD Function :
In MariaDB, the LPAD Function is used for the string that is left-padded with a specified string to a given length. In this function, it will take the first parameter a string, the second parameter length and the third parameter will be pad string.it will return left-padded with a specified string to a given length.

If the string length is greater than the given length then it will remove characters from the string to shorten it to length characters.otherwise it will padding the string from left.

Syntax :

LPAD( string, length, pad_string )

Example-1 :

SELECT LPAD('geeksforgeeks', 15, 'A');

Output :



AAgeeksforgeeks

Example-2 :

SELECT LPAD('Computer', 4, 'x');

Output :

Comp

Example-3 :

SELECT LPAD('DSA', 4, 'gfg');

Output :

gDSA

2. LOWER Function :
In MariaDB, the LOWER Function is used for the converts all characters in the specified string to lowercase. In this first parameter will be the string. And it will return the lowercase of that string. If the characters of the string are not letters then those will not be affected. It works similarly to LCASE function.

Syntax :

LOWER( string )

Example-1 :

SELECT LOWER('GFG');

Output :



gfg

Example-2 :

SELECT LOWER('GeeksForGeeks');

Output :

geeksforgeeks

Example-3 :

SELECT LOWER('DSA@SELF!');

Output :

dsa@self!

3. LTRIM Function :
In MariaDB, The LTRIM Function is used to removes all space characters from the left-hand side of a string. In this function, a string will be passed as a parameter and it will return the zero space at the starting of the string. If the string also contains the space in the right end then this function does not any effects on that.

Syntax :

LTRIM( string )

Example-1 :

SELECT LTRIM('   geeksforgeeks');

Output :

'geeksforgeeks'

Example-2 :

ELECT LTRIM('   gfg  ');

Output :

'gfg  '

Example-3 :

SELECT LTRIM('This is best portal  ');

Output :

'This is best portal  '
My Personal Notes arrow_drop_up
Recommended Articles
Page :