当前位置:网站首页>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
边栏推荐
- Cloud native Devops status survey questionnaire solicitation: kodelurover launched jointly with oschina
- DNS series (III): how to avoid DNS spoofing
- Glusterfs file is not mounted, permission: R-S
- Efficient practice intelligent analysis of massive log data in aviation industry
- ServletContext、request、response
- What to do when encountering slow SQL? (next)
- Information system project manager (2022) - key content: Strategic Management (17)
- Domestic high hidden free agent crawler code
- 金仓数据库KingbaseES安全指南--5.2. 数据完整性保护
- 将数据库拿到的数据渲染到elementUI 中的table中去
猜你喜欢

"Three no's and five requirements" principle of enterprise Digitalization Construction

Security exception handling mechanism

Work fishing clock simulator wechat applet source code

UBI read only file system

【实战】使用 Web Animations API 实现一个精确计时的时钟

Space complexity calculation super full sorting!! (calculation of hand tearing complexity
![[coding and decoding] Huffman coding and decoding based on Matlab GUI [including Matlab source code 1976]](/img/af/27e3794f93166d8ecad9b42dafaf0f.png)
[coding and decoding] Huffman coding and decoding based on Matlab GUI [including Matlab source code 1976]
![[blood vessel detection] Based on MATLAB mom method, combined with Hessian and curve fitting, blood vessel diameter measurement [including Matlab source code, 1970]](/img/72/10bd8a292c3ee3445907795ebf2ae8.png)
[blood vessel detection] Based on MATLAB mom method, combined with Hessian and curve fitting, blood vessel diameter measurement [including Matlab source code, 1970]

校园流浪猫信息记录和分享的小程序源码

Glusterfs file is not mounted, permission: R-S
随机推荐
[performance optimization methodology series] III. core idea of performance optimization (2)
Security exception handling mechanism
Detailed explanation of pl/sql parameters ("box model")
Cloud native Devops status survey questionnaire solicitation: kodelurover launched jointly with oschina
ftp服务器、nfs服务器的搭建和使用
[735. Planetary collision]
24-Openwrt dnsmasq
Information system project manager (2022) - key content: Information System Security Management (20)
.net upload files through boundary
22 openwrt uses external kernel and kernel_ config
Machine learning 06: Decision Tree Learning
Simple summary of Modbus Protocol
[untitled]
Difference between on, where and having
Kingbasees Security Guide for Jincang database -- 4 data access protection
Study notes of Gu Yujia on July 27, 2022
[coding and decoding] Huffman coding and decoding based on Matlab GUI [including Matlab source code 1976]
RT thread changes the print serial port (add other functions on the basis of BSP)
"Three no's and five requirements" principle of enterprise Digitalization Construction
Kingbasees security guide of Jincang database -- 6.2. Configuration files related to authentication