MySQL Foundation Enhancement (myql function)here are only some of the most commonly used, relatively novel:String Functions:
CONCAT
://String Join function
SELECT CONCAT(‘My‘, ‘S‘, ‘QL‘);
SELECT CONCAT(‘My‘, NULL, ‘QL‘);//与null连接会变null
SELECT CONCAT(14.3);
' 14.3 '
concat_ws
://delimited string connection
mysql> SELECT Concat_ws (', ', ' First name ', ' Second name ', ' last Name ');
' First name,second name,last name ' mysql> SELECT concat_ws (', ', ' First name ', NULL, ' last Name ');
' First name,last name '
LOWER (str)/ UPPER (str)//convert string to lowercase or uppercase
Left (str,x)/ Right (str,x)//returns the leftmost X character of the string and the rightmost x character
SUBSTRING (str,x,y)// Extracts the x position of the given string by the Y-character
mysql> select substring (' I love MySQL ', 8,4);
' MySQL '
Find_in_set (str,strlist)//implementation if the string str is in table strlist consisting of n substrings, returns a value of 1 to N. Strlist are composed of ', ' delimited strings.
Example 1:
CREATE TABLE Books (
Comment ' User ID ',
BookName varchar () NOT NULL,
Sort varchar (100)
);
Insert into books (Bookid,bookname,sort) values
(1, ' College English ', ' English,teach '),
(2, ' C language ', ' language,c,old '),
(3, ' Advanced mathematics ', ' teach,olding ');
Select Bookid,bookname from books where Find_in_set (' Teach ', sort);//Where sort is the column of the Book table
SELECT LENGTH
(‘text‘);//返回str的长度
4
Related website:
Mysql5.7 function Address: http://dev.mysql.com/doc/refman/5.7/en/func-op-summary-ref.html
mysql5.x Manual http://doc.mysql.cn/
MySQL official website http://dev.mysql.com/
Mysql5.7 Reference Manual http://dev.mysql.com/doc/refman/5.7/en/
Other reference Manuals
Csdn-mysql Knowledge Base
Author:liuning
MySQL nurturance-mysql Foundation Enhancement (MYQL function)