This article provides a detailed analysis of character-numeric conversion in MYSQL. For more information, see-1. convert a number to a number. For example, if 0 is converted to 0, an addition can be directly used to sort d in the pony table. You can define d as varchar, select * fromponyorderby (d0) 2. ifnul
This article provides a detailed analysis of character-numeric conversion in MYSQL. For more information, see-1. convert a number to a number. For example, if '0' is converted to 0, an addition can be directly used to sort d in the pony table. You can define d as varchar, select * from pony order by (d0) 2. ifnul
This article provides a detailed analysis of character-numeric conversion in MYSQL. For more information, see
-1. Convert the number of characters into numbers. For example, if '0' is converted to 0, it can be directly implemented by addition.
For example, sort d in the pony table and define d as varchar.
Select * from pony order by (d + 0)
2. when performing ifnull processing, for example, ifnull (a/B, '0') will cause a/B to become a string. Therefore, you need to change '0' to 0 to solve this problem.
3. When comparing numbers and varchar, such as a = 11, B = "11 ddddd ";
Select 11 = "11 ddddd" is equal
The comparison can be as follows:
Select binary 11 = binary "11 ddddd"
4. Character Set conversion: CONVERT (xxx USING gb2312)
Type conversion is similar to SQL Server, that is, the type parameters are a little different: CAST (xxx AS type), CONVERT (xxx, type), The type must use the following types:
Available types
Binary, with a BINARY Prefix: binary
Character type, with parameters: CHAR ()
DATE: DATE
TIME: TIME
DATETIME type
Floating Point: DECIMAL
Integer: SIGNED
UNSIGNED integer
Detailed source reference: http://www.jb51.net/article/38285.htm