LPAD, LOWER and LTRIM Function in MariaDB

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

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.