MySQL provides us with two types of conversion functions: cast and convert, how can we let go of the ready-made stuff?1 BINARY[(N)]2 CHAR[(N)]3 DATE4 DATETIME5 DECIMAL6Signed[INTEGER]7 Time8UNSIGNED[INTEGER]Example:--use cast to convert varchar to
Original: http://www.2cto.com/database/201310/250880.htmlSQL cast and CONVERT usage detailed Summary: The following applies only to Mysqlselect {fn CONCAT (CONVERT (User_id,char), user_name)} as Str from T_SYS_ User following this applies only to
In mysql, if I use common data sorting methods, we may not get the expected results, but mysql provides us with the CAST CONVERT function, which can CONVERT numbers accordingly, I used this function to sort Chinese characters in the past.
Let's
Mysql varchar sorting CAST, CONVERT function type conversion, varcharconvert
When creating a table on your own, you should create a field type as varchar (2). In fact, it should be set as integer (2). But today, we found a Sorting Problem in the
When you build the table, a field type is created as varchar (2), in fact, it should be built as an integer (2), but today in the background to find the problem of sorting, varchar sort has a problem, so how to solve it?Example table structure:
Simple to say about MySQL's varchar sorting problem, a cautionary tale.
Sample Table structure:
Let's take a look at my table structure
code is as follows
copy code
Show create table Cardserver G **************
Is today in the background to find a sort of problem. So, there's no way to change it. Here is a brief look at MySQL varchar sorting problem, warning.
Sample Table structure:Let's take a look at my table structure
The code is as follows
How to Use substring in oracle Database CONVERT (varchar (12), getdate (), 112), substringgetdate
SqlserverI often need to perform some time-type field conversions, but I don't quite remember it. So I collected the following
First Reader Network reference
The code is as follows
Copy Code
CONVERT (expr USING transcoding_name)
In MySQL, transcoding names are the same as the corresponding character set names.
Examples:
MySQL database converts int to varchar for slow query, mysqlvarchar
Two slow queries are processed in the last week because the int type cannot be converted to varchar.
CREATE TABLE `appstat_day_prototype_201305` (`day_key` date NOT NULL DEFAULT '190
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.