MySQL Learning--commonly used functions (String functions)

Source: Internet
Author: User
Tags strcmp

String functions in MySQL

Function Function
CONCAT (s1,s2,... sn) Connect S1,s1...sn to a string
INSERT (STR,X,Y,INSTR) The string str starts at the x position, and the substring of y characters is replaced with the string instr
LOWER (str) Turns the string str into lowercase
UPPER (str) Turn string str to uppercase
Left (str,x) Returns the character of the leftmost x of the string str
Right (STR,X) Returns the character of the rightmost x of a string
Lpad (Str,n,pad) Fill the leftmost str with a string pad until the length is N string length
Rpad (Str,n,pad) Padding the rightmost of str with a string pad until the length is N string length
LTRIM (str) Remove string Str left space
RTRIM (str) Remove string str right space
REPEAT (str,x) Returns the result of repeated x times of STR
REPLACE (STR,A,B) Substitute string B for string A in str
STRCMP (S1,S2) Compare String S1,s2
TRIM (str) Remove string line endings and wardrobe spaces
SUBSTRING (Str,x,y) Returns a string of Y-length strings from the str x position of the string

CONCAT: Concatenate incoming arguments into a string, any string and null join IS NULL

    

INSERT: The string str starts at position x, and the substring of y characters is replaced with a string instr

    

Lower,upper: Converts a string to lowercase or uppercase

    

Left,right: Returns the leftmost and rightmost x characters of the string, if the second argument is null, there will be no return

   

Lpad,rpad: Padding with the leftmost and rightmost characters of the string str until the length is n strings

  

Ltirm,rtirm: Remove string str left and right spaces

  

REPEAT: Returns the result of repeated x times of STR

  

Replace: Substitute string B for string A in str

  

STRCMP: The size of the ASCLL code of the string S1 and S2, if S1 is smaller than S2 return -1,s1 and S2 equals return 0,s1 greater than S2 return 1

  

TRIM: Removes whitespace at the beginning and end of the target string

  

SUBSTRING: Returns a string of y string lengths from position x in str

  

MySQL Learning--commonly used functions (String functions)

Related Article

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.