MySQL database functions

Source: Internet
Author: User

One: String function:

1.concat ();

Concat (S1,s2,s3,...... SN);

Link the incoming parameters into a string;

2.insert ();

Insert (Str,x,y,insert);

St R: The passed-in string,

X: Starting from the first few

Y: You need to replace several characters

Insert: String to replace

  

3.lower (), Upper ()

Lower (): string converted to uppercase;

Upper (): string converted to lowercase;

   

4.left (str,x) Right (Str,y)

STR: The string to be returned

X: Returns the number of characters

5.rpad (Str,n,pad)

STR: Characters that need to be populated

N: Length of the string after padding

Pad: Characters that need to be populated

6.trime ()

Remove spaces on both sides of the string

7.replace (STR,A,B)

STR: The string to be replaced

Use string B to replace a in Str

8.STRCMP (S1,S2)

Returns 1 if S1 is greater than S2

If S1 is less than S2 returns-1

If S1 equals S2 returns 0

9.substring (Str,x,y)

STR: The string to be returned

X: Starting at position x

Y: Take y characters

Two: Numerical functions:

1.ABS (x) returns the absolute value of X

2.ceil (x) returns the minimum value greater than X

3.floor (x) returns the maximum value less than X

4.med (x, y) returns the Touch (redundancy) of X, Y

5.rand () return random number

6.round (x, y) returns the value of the rounding Y position of X (rounded)

7.truncate (x, y) returns the fractional result of a number x truncated to Y;

Three: Time function:

1.curdate () returns the current date 2014-7-4

2.curtime () returns the current time 12:00:01

3.now () returns the current time 2014-7-4 12:00:01

4.unix-time (now ()) returns the current timestamp 1293433835

5.time () timestamp conversion time (1293433835)

6.week () returns the current day of the week

7.data_format () Format current time Date_format (now (), '%b%d%Y%h:%i%p ') Dec 11:45 PM

    

  

 

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.