TRAILING
TRAILING is an SQL property used in the TRIM() function to remove specified characters from the end of a string value. The characters can be spaces or other specified characters. It helps in refining and cleaning data within SQL databases.
Example
Output
Explanation
The TRIM(TRAILING ... )
function in MySQL removes the trailing character that is specified in the parentheses. In the above example, it removes trailing ‘0’ from ‘9000’. The output becomes ‘9’ after removal of trailing zeros.
Example
Output
Explanation
The TRIM(TRAILING FROM string)
function in PostgreSQL is used to remove any trailing whitespaces from the specified string. In the given example, trailing whitespaces from the string ‘PostgreSQL ’ are removed, resulting in ‘PostgreSQL’.
Example
Output
Explanation
The TRIM()
function in this example removes (trims) any trailing ‘0’ characters from the string ‘7000’. The result is ‘700’.