Thoughts on a Mysql statement

Source: Internet
Author: User

A piece of Thinking Caused by a Mysql statement today I saw a mysql statement written by my colleagues, but I suddenly felt the gap. In my mind, mysql statements are only added, deleted, queried, and modified. They can still be written in this way. [Php] $ SQL = "SELECT category_general_table FROM product_category WHERE category_id IN (SELECT DISTINCT CAST (SUBSTRING (product_code, 1, 5) AS UNSIGNED) AS cid FROM product_index WHERE member_id = $ memberId AND shop_id = $ shopId) "; I have never written this like CAST or SUBSTRI NG. After checking the manual, another function CONVERT is similar to it. Cast (value as type); Convert (value, type); type can not be dropped. The type that can be converted is binary, which has the same effect as BINARY prefix, possible parameter: CHAR () DATE: date time: time date type: DATETIME floating point number: decimal integer: signed unsigned integer: UNSIGNED it seems that I still have to read more manual.

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.