The TRIM function in SQL is used to remove the header or the end of a string of characters. The most common use is to remove the blank at the beginning or end of the word. This function has different names in different repositories:
Mysql:trim (), RTRIM (), LTRIM ()
Oracle:rtrim (), LTRIM ()
SELECT FIRSTNAME | | ' ' || RTRIM (LASTNAME) as "with RTRIM" from STUDENTS WHERE rownum < 11
SELECT
LTRIM (FIRSTNAME) as "LTRIM"
From STUDENTS
SQL Server:rtrim (), LTRIM ()
The syntax for the various trim functions is as follows:
TRIM ([[Location] [string to remove] from]: the possible values for [position] are leading (start), trailing (end), or BOTH (beginning and end). This function removes the string to be removed from the beginning, end, or start and end of the string. If we do not list [the string to be removed], the whitespace will be removed.
LTRIM (String): Removes the blank space from the beginning of all strings.
RTRIM (String): Removes the whitespace from the end of all strings.
WHERE RowNum < 11