Linux SQL statement Concise tutorial---TRIM

Source: Internet
Author: User
Tags rtrim

The TRIM function in SQL is used to remove the head or end of a string.

The most common use is to remove whitespace from the beginning or end of the word. This function has different names in different repositories:

    • Mysql:trim (), RTRIM (), LTRIM ()
    • Oracle:rtrim (), LTRIM ()
    • SQL Server:rtrim (), LTRIM ()

The syntax for various trim functions such as the following:

TRIM ([[position] [string to remove] from] string: Possible values for [position] are leading (beginning), TRAILING (end), or BOTH (beginning and ending). This function removes the string [to be removed] from the beginning, end, or beginning and end of the string. Assuming we don't have a list of [strings to remove], the blanks will be removed.

LTRIM (String): Removes all whitespace from the beginning of the string.

RTRIM (String): Removes whitespace from the end of all strings.

Example 1

SELECT TRIM (' Sample ');

Results:

' Sample '

Example 2

SELECT LTRIM (' Sample ');

Results:

' Sample '

Example 3

SELECT RTRIM (' Sample ');

Results:

' Sample '


Linux measurements such as the following:




Reprint please specify: Xiao Liu



Linux SQL statement Concise tutorial---TRIM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.