MySQL built-in functions summary

Source: Internet
Author: User

One. String functions

Select concat (Name, "Age was", age) from users;   Insert (Str,x,y,insert)//Replace y position of string x position with insert  Select Lower (str) upper (str)//conversion caseSELECT * from user where upper (name) = ' AAA ';  left (str, x) Right (STR,X)//returns the X-characters on both sidesSelect Left ("Abcdee", 3), right ("Abcdedd", 3), left ("Abcdedd", null);  Lpad (Str,n,pad), Rpad (Str,n,pad)//using a string pad to fill n bits on the leftmost or rightmost side of STR  LTrim ()substring (str,x,y)//returns the X position of the string, taking Y characters    two. Numeric FunctionsABS (x)//returns the absolute value of xceil (x)//returns the smallest integer greater than xFloor (x)//returns the largest integer less than xmod (x, y) returns the film X/yrand ()//0-1 random number betweenround (x, y)//Returns the rounding of parameter x with a value of y decimal placetruncate (x, y)//Returns the result of the number x truncation of the y decimal place    three. Date functionuse PHP's timestamp to completeSelect Curdate ()curtime ()Now ()Unix_timestamp (now ())Unix_timestamp (date)//unix timestampfrom_unixtime ()//and UNIX timestamps convert each otherWeek ()Year ()Hour ()minute ()...         Select Now ()Select Unix_timestamp (now ())Select From_unixtiom (1293433835);Select From_unixtime ()Select Week (now ())Select Minute/hour (Curtime ())Select Data_format (now (), "%y-%m-%d%h%i%s")    four. Process Control functionsCREATE TABLE salary (ID int,salary decimal (9,2));INSERT into salary values (1,1000);***** if (value,t f)Select if (salary>3000, ' height ', ' low ') from salary;ifnull (value1,value2)Select Id,salary,ifnull (salary,0) from salaryCase When[value1] then[result1]...else[default] EndCase when ... thenSelect Case when salary<=300 and ' low ' else ' high ' end from salary;    Five. Other functionsdatabase ()Version ()//view the current version of the databaseUser ()//view current usersInet_aton (IP)//Return IP address of the network since sequencingInet_ntoa ()//Return the IP address of the network from the sequencing Representativepassword ()//string encryption, for MySQL system usersSelect password (' 123456 '); MD5 ()//Encrypt website usersSELECT * from Mysql.user \g;//view from MySQL Library user table

Java enterprise-Class generic rights security framework source SPRINGMVC MyBatis or Hibernate+ehcache Shiro Druid Bootstrap HTML5

"Java Framework source code download"

MySQL built-in functions summary

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.