Mysql Numeric type conversion function

Source: Internet
Author: User

1. convert int to varchar often using concat function, such as concat (8, ' 0 ') to get string ' 80 '

and menu_name like CONCAT (CONCAT ('% ', #{pd.keywords}), '% ')

2. Convert varchar to int with cast (a as signed) a as varchar type string
Summary: Type conversions are like SQL Server, where type parameters are slightly different: CAST (xxx as type), convert (XXX, type)
Types of available
Binary , with binary prefix effect: binary
character type, with parameters: CHAR ()
Date: date
Time:
DateTime Date/Time type
floating point number: DECIMAL
integer: Signed
unsigned integer: UNSIGNED

SELECT * from Sys_menu where parent_id= ' 0 ' ORDER by cast (Menu_no as signed)

When Menu_no is a letter or kanji, the number converted is 0.

This article is from the "Jianbo" blog, make sure to keep this source http://jianboli.blog.51cto.com/12075002/1958445

Mysql Numeric type conversion function

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.