当前位置:网站首页>MySQL: data types and operators
MySQL: data types and operators
2022-07-28 04:25:00 【_ Soren】
Preface
MySQL The data type defines the size range of the data , Therefore, choose the appropriate type when using , It will not only reduce the disk space occupied by the table , Indirectly reduces the number of disks I/O The number of times , Improved table access efficiency , And the efficiency of index is also closely related to the type of data .
List of articles
data type
value type
When creating a table, it should be based on the scene Choose the appropriate numerical type , Although the type looks similar in byte size , But if there are thousands of pieces of data , It will waste a lot of space .
String type

Be careful : String type CHAR(M), The number in this bracket represents the number of bytes , But sometimes we see this kind of problem ,
Parentheses after integer type :
The memory size occupied by shaping is fixed , Is strongly related to specific types , This 9 Represents the width of integer display .
age INT(9)
Date and time type

The date type is also in the process of doing the project , Frequently used type information , In especial TIMESTAMP and DATETIME Two types , But notice TIMESTAMP Will automatically update the time , It is very suitable for those scenarios that need to record the latest update time , and DATETIME Need to update manually .
Timestamp example :
enum and set
These two types , It is restricted that this field can only take a fixed value , But the enumeration field can only take a unique value , The set field can take any value .
Example : Set gender to a fixed value , If you enter others, you will report an error .
sex enum(‘M’, ‘W’) default ‘M’
Operator
Arithmetic operator

Logical operators

Comparison operator

Wildcard match like: There are two wildcards
%
_
Example :
There are three names :
zhang san
zhang yao
zhangx
select* from where name like ‘zhang%’; // Can match all zhang At the beginning
select* from where name like ‘zhang_’; // Means only match zhang The last character
边栏推荐
- 40: Chapter 4: Development File Service: 1:fastdfs: (1): introduction to fastdfs;
- [blood vessel detection] Based on MATLAB mom method, combined with Hessian and curve fitting, blood vessel diameter measurement [including Matlab source code, 1970]
- What is the account opening process of qiniu business school? Is it safe?
- Password key hard coding check
- C#跨线程刷新前台UI
- Shell rental reptile
- "Three no's and five requirements" principle of enterprise Digitalization Construction
- 重要的 SQL Server 函数 - 日期函数
- glusterfs 文件未挂载,权限: r-s
- Kotlin——函数
猜你喜欢
![[untitled]](/img/e9/4b00244b67af5ddaa3f35baa1ac968.png)
[untitled]

null安全与异常

将数据库拿到的数据渲染到elementUI 中的table中去

Study notes of Gu Yujia on July 27, 2022

Information system project manager (2022) - key content: intellectual property rights and standards and specifications (22)

glusterfs 文件未挂载,权限: r-s

Information system project manager (2022) - key content: Knowledge Management (15)

DNS series (III): how to avoid DNS spoofing

RT thread changes the print serial port (add other functions on the basis of BSP)

Go structure
随机推荐
7/27(板子)染色法判定二分图+求组合数(递推公式)
【无标题】
Cloud native Devops status survey questionnaire solicitation: kodelurover launched jointly with oschina
Cookies and session
Servlet usage
The unsatisfied analysis of setup and hold timing is the solution
校园流浪猫信息记录和分享的小程序源码
21 openwrt kernel module changed to.Ko automatic loading
Linux - MySQL advanced (day19)
重要的 SQL Server 函数 - 其他函数
Construction and use of FTP server and NFS server
功耗:Leakage Power
Kotlin——函数
Go结构体
25 openwrt guest network add
Chinese Remainder Theorem of X problem
Solana「迷惑行为」:造手机、开门店
JDBC usage
How to select reliable securities analysts?
金仓数据库KingbaseES安全指南--6.2. 身份验证相关的配置文件