1. Char and varchar types Char and varchar types are similar and are used to store strings, but they save and retrieve strings in different ways. char is a fixed-length character type, and varchar is a variable-length character type. For example: for the two type definitions of char(4) and varchar(4): (1), '' occupies 4 bytes in char(4), while varchar(4) only occupies one byte. The length of 4) occupies a length of 4 bytes, and varchar(4) occupies a length of 5 bytes; why is there an extra byte length in the varchar type? This is because the varchar type uses the extra byte to store the actual length of the varchar type. The retrieval of char(4) and varchar(4) is not always the same,
1. Comprehensive understanding of data types in MySQL
#Introduction: 1. Char and varchar types Char and varchar types are similar. They are both used to store strings, but they save and retrieve strings in different ways. . char is a fixed-length character type, and varchar is a variable-length character type. For example: for the two type definitions of char(4) and varchar(4): (1), '' occupies 4 bytes in char(4), while varchar(4) only occupies one byte. The length
2. Detailed explanation of the method of converting varchar type to date type in MySQL
Introduction: The following table: First use the str_to_date function to convert its varchar type to a date type, and then sort from small to large. Syntax: select str_to_date(class_time,'%Y%m%d % H:%i:%s') a from a order by a desc ; Let's take a look at the date format conversion of varchar type in oracle date type The date format conversion of varchar type in oracle date type SELECT to_char(to
3. Slow query problem caused by converting int type to varchar type in MySQL database
Introduction: In the past week, we have processed two slow queries that were caused by the inability to use the index when converting int to varchar. CREATE TABLE `appstat_day_prototype_201305` (`day_key` date NOT NULL DEFAULT '1900-01-01. ',`appkey` varchar(20) NOT NULL DEFAULT '',`user_total` bigint(20) NOT NULL DEFAULT '0',`user_act
4. Mysql database Introduction to the method of converting varchar type into int type
##Introduction: I told you about it in the previous article The slow query caused by converting int to varchar in MySQL database. This article will introduce to you the method of converting varchar type into int type in Mysql database. Let's take a look! Mysql provides us with two type conversion functions: CAST and CONVERT, ready-made. How can we let go of things? The CAST() and CONVERT() functions can be used to get the value of one type and generate another type
##5.MySQL Basic Tutorial 3 — String type of data type
## Introduction: String type refers to CHAR, VARCHAR, BINARY, VARBINARY , BLOB, TEXT, ENUM and SET. This section describes how these types work and how to use them in queries. 1. CHAR and VARCHAR types CHAR and VARCHA...
6.
Mysql Advanced (8) How to sort varchar typesIntroduction: In MySQL, the default order by can only sort numbers and date types, but it seems useless for sorting varchar character types. Let me introduce to you how to solve the problem of varchar type sorting. 7. Advanced mysql (8) How to sort varchar types Introduction: In MySQL, the default order by can only sort numbers and date types, but it seems useless for sorting varchar character types. Let me introduce to you how to solve the problem of sorting varchar types. . Introduction: sql: The primary key of the data table is of varchar type and will not increase automatically. How to insert the primary key when inserting data Introduction: SQL: The primary key of the data table is of varchar type and does not increase by itself. How do I insert the data when inserting data? Insert primary key
Introduction: String types refer to CHAR, VARCHAR, BINARY, VARBINARY, BLOB, TEXT, ENUM and SET. This section describes how these types work and how to use them in queries. 1. CHAR and VARCHAR types [Related Q&A recommendations]: utf-8 - varchar(M) in mysql, the maximum value of M Value problem Latitude and longitude coordinates - How are latitude and longitude stored in the mysql database? When there is a large amount of data in longtext in mysql, will the query be very slow?
The above is the detailed content of 10 course recommendations on varchar type. For more information, please follow other related articles on the PHP Chinese website!