MySQL functions-other functions, mysql Functions

Source: Internet
Author: User
Tags mysql functions

MySQL functions-other functions, mysql Functions

IF (expr, v1, v2) expr expression is true, v1 is returned; otherwise, v2 is returned.

IFNULL (v1, v2) If v1 is NULL, v2 is returned. If v1 is not NULL, v1 is returned.

CASE expr WHEN v1 THEN r1 [WHEN v2 THEN r2] [...] [ELSE m] END

If expr is equal to the value in v1.v2..., return r1, r2. After THEN. Otherwise, return the value m after ELSE.

Case when v1 THEN r1 [WHEN v2 THEN r2] [...] [ELSE m] END

If a value in v1, v2... is true, the value after THEN is returned. Otherwise, the value after ELSE is returned.

VERSION () returns the MySql VERSION.

CONNECTION_ID () returns the current Mysql connection count

Show processlist; show full processlist; display the running thread

DATEBASE (), SCHEMA () returns the current database

USER (), CURRENT_USER (), SYSTEM_USER (), SESSION_USER () returns the current USER name

CHARSET (str) returns the str Character Set

COLLATION (str) returns the str character Arrangement

LAST_INSERT_ID () returns the id value generated at the end of AUTO_INCREMENT. If you insert data in batches, the first

Encryption-MD5 (str) returns str MD5 encryption 32-bit hexadecimal

 

Encrypted ENCODE (str, pwd_str) uses pwd_str as the password to encrypt str, a binary string with the same length as str

Decrypts DECODE ('str', pwd_str) and decrypts pwd_str as a password, which is an inverse function of the preceding ENCODE ().

FORMAT (x, n) FORMAT the number x, retain n as the decimal number, and return it as a string

CONV (N, from_base, to_base) converts N from from_base to to_base.

BENCHMARK (count, expr) repeated expr execution total count

CONVERT (str USING charset) converts str to the corresponding charset

CAST (x AS type), CONVERT (x, type) returns the value of converting x to type

 

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.