MySQL nurturance-mysql Foundation Enhancement (MYQL function)

Source: Internet
Author: User
Tags knowledge base

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)

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.