MySQL functions, keywords, features

Source: Internet
Author: User
Tags mysql functions

# # MySQL intercept function left (), right (), substring (), Substring_index ()
SELECT left (' www.baidu.com ', 3); # www
SELECT right (' www.baidu.com ', 3); # com
SELECT SUBSTRING (' www.baidu.com ', 3); # w.baidu.com
SELECT SUBSTRING (' www.baidu.com ',-3); # com
SELECT SUBSTRING (' www.baidu.com ', 5,5); # Baidu
SELECT substring_index (' www.baidu.com ', '. ', 1); # www
SELECT substring_index (' www.baidu.com ', '. ',-2); # baidu.com

#demo between and is a number that contains the equals sign,
SELECT T. ' Order_no ', left (T. ' Rent_time ', 8), left (T. ' Revert_time ', 8) from Trans T WHERE order_no= ' 491542211061 '
and left (T. ' Rent_time ', 8) between 20160115 and 20160116;

# MySQL settings update column time auto-Modify time
' Update_time ' TIMESTAMP not NULL the DEFAULT current_timestamp on update current_timestamp COMMENT ' Update Time ',

MySQL functions, keywords, features

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.