My MySQL Learning notes (iv)--functions

Source: Internet
Author: User

Numeric Functions
1, the remainder function mod (x, y)

MoD (x, y) returns the remainder after X is removed by Y, and the MoD () also works for numbers with fractional parts, returning the exact remainder of the division operation.

2. Function truncate (x, y)

TRUNCATE (x, y) returns the number X that is removed to the Y-digit after the decimal point. If Y has a value of 0, the result does not have a decimal point or a fractional part.

If Y is set to a negative number, then the value of all lows after the beginning of the first Y-position of the decimal point is truncated (zeroed).

The Tips:round (x, y) function is rounded when the value is intercepted, and truncate (x, y) intercepts the value directly, not rounding
3, HEX (N)
Convert N to hex and return with string (n is bigint number, equivalent to Conv
(n,10,16))

Unhex is the inverse function of hex

character Functions
1, the Char_length (str) return value is the number of characters that the string STR contains. A multibyte character counts as a single character

2. Combine string function Concat_ws (x,s1,s2,...... )

Concat_ws (X,s1,s2,...... ), Concat_ws represents CONCAT with Separator, which is a special form of the CONCAT () function.

The first parameter, X, is the delimiter for the other parameters, where the delimiter position is placed between the two strings to be concatenated. The delimiter can be a string, or it can be a

Other parameters. If the delimiter is null, the result is null. The function ignores null values after any delimiter parameters.

3. INSERT (STR,POS,LEN,NEWSTR)
Returns a string str, a substring starting at position pos, and Len characters long substrings are replaced by string newstr

My MySQL Learning notes (iv)--functions

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.