TRAILING
Example
Section titled “Example”SELECT TRIM(TRAILING '0' FROM '9000');Output
Section titled “Output”'9'Explanation
Section titled “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
Section titled “Example”SELECT TRIM(TRAILING FROM 'PostgreSQL ');Output
Section titled “Output”'PostgreSQL'Explanation
Section titled “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
Section titled “Example”SELECT TRIM(TRAILING '0' FROM '7000') AS TrimmedStringFROM dual;Output
Section titled “Output”TrimmedString-------------700Explanation
Section titled “Explanation”The TRIM() function in this example removes (trims) any trailing ‘0’ characters from the string ‘7000’. The result is ‘700’.