The LTRIM function removes leading spaces, and in some database systems specified leading characters, from a string.
Leading spaces can make otherwise identical values behave differently during comparisons and data analysis.
Remove leading spaces from employee names.
SELECT
LTRIM(EmployeeName) AS CleanEmployeeName
FROM Employees;
LTRIM is useful for cleaning imported files, text fields, identifiers, and customer information.
- LTRIM removes leading spaces.
- It cleans the beginning of strings.
- It is useful for imported data.
- It can improve text comparisons.
- Exact character-removal syntax varies.
What does LTRIM do?
LTRIM removes unwanted leading spaces from a string.
How is LTRIM different from TRIM?
LTRIM focuses on the beginning of a string, while TRIM generally removes unwanted characters from both ends.