MySQL function (take a look and look at it carefully)

Source: Internet
Author: User
Tags mathematical functions md5

MySQL function

Description: Mathematical functions, String functions, date-time functions, conditional judgment functions, System information functions, cryptographic functions, etc.

1. Mathematical Functions

2. String Functions

3. Date Time function

4. Conditional Judgment Function

A) IF (expr, V1, v2)

Returns v1 If the expression expr is true ,otherwise returns v2

Example: SELECT ID, age, IF (age>18, ' OK ', ' NO ') from table1;

B) ifnull (v1, v2)

if the value of V1 is empty, V2 is returned

Example: SELECT ID, ifnull (email, ' is NULL ') from table1;

C) case

<when expression 1 then v1>

[When expression 2 then v2]

... ...

[When expression n then vn]

[ELSE DEFV]

END;

5. System Information Function

6. Cryptographic Functions

A) One-way encryption

PASSWORD (' string ');

Used for encrypting passwords and can only be encrypted and not decrypted.

B) MD5 (' string ')

that is used to extract files. MD5

C) symmetric encryption
Encoed (' string ', ' password ') encrypt string

Dencoed (' encrypted string ', ' password ') decrypts the string

7. Other Functions

A) Format function

FORMAT (X, Y)

Digital X Keep Y bit after decimal point

B) in-process conversion

BIN (X) : converting to binary

Hex (X): Convert to Hex

OCT (X): converting to octal

CONV (x, F1, F2): converts X from F1 into F2 Binary

C) IP address Translation

Inet_aton (IP): points converted to UINT32

Inet_ntoa (N):UINT32 Conversion to electrical Division

D) Locking

GET_LOCT (name, time): Locked, name is the name of the lock .

IS_FREE_LOCT (name): Unlock

F) Repeat

BENCHMARK (n, expression ): expression repeats n times

G) Changing the character set of a string

H) Change the type of the field

MySQL function (take a look and look at it carefully)

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.