MySQL string usage

Source: Internet
Author: User

Replace (STR,FROM_STR,TO_STR)--Replaces the substring in str with string To_str from_str and returns--mysql> Select Replace (' www.mysql.com ', ' w ', ' WW ');---> ' wwwwww.mysql.com '--substr (addtime, 1, Ten)--substr (string string,num start,num length);-- String--start as the starting position--length for length select D.uid, SUBSTR (U.addtime, 1,) as registration time, d.cid as CID from USER_EXTR A_device d, user u where d.uid= u.id and u.addtime>= "2017-01-09 00:00:00" ORDER by SUBSTR (U.addtime, 1, 10)-From 3 characters on the left (' example.com ', 3)--the result exa--3 characters from the right----example.com, 3--from the 4th character position of the string. Until the end of select substring (' example.com ', 4)--mple.com--from the 4th character position of the string, take only 2 characters select substring (' example.com ', 4, 2)-- Starting from the 4th character position (reciprocal) of the string, until the end of select substring (' example.com ',-4)--. com--starts from the 4th character position (reciprocal) of the string, taking only 2 characters select substring (' example.com ', -4, 2) concat (left (Reg2/install *100, 5), '% ') as registration rate $sql= "SELECT concat (ID,"-", con) as res from article wh Ere id=1 "--#身份证件号码前" ' ", to avoid the output after the display of the scientific calculation method select Uid,concat (" ' ", Cardno) as" ID numberYards "from user_authentic where State =2 

  

MySQL string usage

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.