Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone explain the Trim function in SQL?

1 Answer

0 votes
by (119k points)
edited by

In SQL, TRIM () function is used to remove the characters from the starting or ending of strings and removes the padded spaces on both sides of the string.

Here is an example to used TRIM () function in SQL:

SELECT TRIM ('@! '  FROM '    !SQL Tutorial@   ') AS Trimmed_String;

You will get the result as ‘SQL Tutorial’ on running the above SQL. You can also use RTRIM () function to remove the spaces at the starting of the string and LTRIM() to remove the spaces at the end of the string.

If you want to take a course that can provide Instructor-led training and certification then check out this SQL training course by Intellipaat.

Related questions

0 votes
1 answer
asked Oct 19, 2020 in SQL by dev_sk2311 (45k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Dec 30, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
asked Dec 5, 2020 in SQL by Appu (6.1k points)

Browse Categories

...