MySQL built-in function learning notes

Source: Internet
Author: User

Tag: Date () now () pattern string intercept uppercase Max Ike string--

    • Character functions
    • numeric operators and functions
    • comparison operators and functions
    • Date-time functions
    • Information functions
    • Aggregation functions

One, character functions

    • CONCAT (): Character connection
    • Concat_ws (): Character join with specified delimiter
    • Format (): Numeric formatting
    • LOWER (): Convert to lowercase letter
    • UPPER (): Convert to uppercase
    • Left (): Gets the character
    • Right (): Gets the character
    • Length (): Gets the string length
    • LTRIM (): Remove leading spaces
    • RTRIM (): Delete subsequent spaces
    • SUBSTRING (): String intercept
    • ' Not ' like: pattern matching
    • Replace (): string substitution
mysql> SELECT CONCAT (' SUN ', ' * ', ' YUE ', ' * ', ' RU '); +----------------------------------+| CONCAT (' SUN ', ' * ', ' YUE ', ' * ', ' RU ') |+----------------------------------+| Sun*yue*ru                       |+----------------------------------+1 row in Set (0.00 sec)
mysql> SELECT concat_ws (' & ', ' SUN ', ' YUE ', ' RU ');
+---------------------------------+
| Concat_ws (' & ', ' SUN ', ' YUE ', ' RU ') |
+---------------------------------+
| Sun&yue&ru |
+---------------------------------+
1 row in Set (0.00 sec)
Mysql> SELECT FORMAT (1223456.78,1);
+----------------------+
| FORMAT (1223456.78,1) |
+----------------------+
| 1,223,456.8 |
+----------------------+
1 row in Set (0.00 sec)
.
.
.

  

Second, numeric operators and functions

    • Ceil () into a rounding
    • Div Integer rounding
    • Floor () Rounding and rounding
    • MOD take-up (modulo)
    • ROUND () rounding
    • TRUNCATE () Digital intercept

Third, comparison operators and functions

    • [NOT] Between ... And ...
    • [NOT] In ()
    • is [NOT] NULL

Four, date Time function

    • Now ()
    • Curdate ()
    • Curtime ()
    • Date_add ()
    • DATEDIFF ()
    • Date_format ()

Http://www.w3school.com.cn/sql/sql_dates.asp

Five, information function

    • CONNECTION_ID () connection ID
    • Database () Current databases
    • LAST_INSERT_ID () The ID number of the last inserted record
    • User () Current users
    • Version () Release information

Vi. Aggregation functions

    • AVG ()
    • COUNT ()
    • MAX ()
    • MIN ()
    • SUM ()

MySQL built-in function learning notes

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.