TRIM Databricks


                   TRIM Databricks

In Databricks, you can use the trim function to remove leading and trailing spaces or other characters from a string. Databricks supports several variations of the trim function:


Removes leading and trailing spaces from the string str.

trim(BOTH trimStr FROM str)

Removes leading and trailing occurrences of the characters in trimStr from the string str.

ltrim(str) or trim(LEADING FROM str)

Removes leading spaces from the string str.

rtrim(str) or trim(TRAILING FROM str)

Removes trailing spaces from the string str.


SELECT trim(‘ Hello World! ‘); — Output: ‘Hello World!’
SELECT trim(BOTH ‘!’ FROM ‘!!!Hello World!!!’); — Output: ‘Hello World’
SELECT ltrim(‘ Hello World!’); — Output: ‘Hello World!’
SELECT rtrim(‘Hello World! ‘); — Output: ‘Hello World!’

Databricks Training Demo Day 1 Video:

You can find more information about Databricks Training in this Dtabricks Docs Link



Unogeeks is the No.1 IT Training Institute for Databricks Training. Anyone Disagree? Please drop in a comment

You can check out our other latest blogs on Databricks Training here – Databricks Blogs

Please check out our Best In Class Databricks Training Details here – Databricks Training

 Follow & Connect with us:


For Training inquiries:

Call/Whatsapp: +91 73960 33555

Mail us at:

Our Website ➜

Follow us:





Leave a Reply

Your email address will not be published. Required fields are marked *