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