TRIM (variations)
TRIM (variations) is a SQL function in the String Functions category. LTRIM removes leading spaces, RTRIM removes trailing spaces. TRIM with spec removes specific characters. The syntax is LTRIM(string) / RTRIM(string) / TRIM([LEADING|TRAILING|BOTH] chars FROM string). It accepts string. It returns trimmed string. A typical example: SELECT LTRIM(' hello'); -- 'hello' SELECT RTRIM('hello '); -- 'hello' -- TRIM with specific chars: SELECT TRIM(BOTH 'x' FROM 'xxHelloxx'); -- 'Hello' SELECT TRIM(LEADING '0' FROM '00123'); -- '123' -- MySQL: TRIM(), LTRIM(), RTRIM() -- PostgreSQL: same -- SQL Server: LTRIM/RTRIM, TRIM(removing specific chars in 2017+) -- Oracle: LTRIM/RTRIM/TRIM A close relative is CONCAT(), which concatenates two or more strings into one string. Returns NULL if any argument is NULL. A close relative is SUBSTRING(), which extracts characters from a string starting at position `start` for `length` characters. A close relative is REPLACE(), which replaces all occurrences of `from_string` with `to_string` in a string.