当前位置:网站首页>MySQL learning notes - data type (numeric type)
MySQL learning notes - data type (numeric type)
2022-07-04 15:13:00 【Murshaw 756】
Catalog
4.2 Floating point numbers VS Fixed-point number
One 、 Data type refinement
1、MySQL Data types in
2、 Integer types
2.1 Type introduction
Example :
8.0 There will be (), for example tinyint(4), It represents the number of digits occupied by the plus symbol , and -128 To +127 Namely 4 position . If you use unsigned UNSIGNED, Namely 3.8.0 It is not recommended to specify the width in the future .
2.2 Optional attribute
1、 Do not apply ZEROFILL when , It doesn't matter whether you specify the display width or not . Use ZEROFILL when , Specify the display width as n, When insert Insufficient value for n position , Just use 0 fill , If exceeded n position , You don't have to .
2、 When using ZEROFILL when , Automatically add UNSIGNED
2.3 Use scenarios
2.4 How to choose
3、 Floating point type
3.1 Type introduction
3.2 Data accuracy description
Example :
1、 Use FLOAT and DOUBLE when , Better not add M and D.
2、 In programming , If floating point numbers are used , Pay special attention to the error , Because floating point numbers are inaccurate , So try to avoid using = To determine whether two floating-point numbers are equal . stay MySQL Inside , With more precise data types :DECIMAL;
4、 Fixed point number type
4.1 Type introduction
Use DECIMAL when , General plus M and D, If not , Default (10,0).
4.2 Floating point numbers VS Fixed-point number
The advantage of floating-point number over fixed-point number is that when the length is certain , Floating point type has a wide range of values , But not exactly , It is suitable for large range of values , It can also tolerate small errors in scientific computing scenarios ( Like computational chemistry 、 Molecular modeling 、 Flow mechanics, etc )、
The value range of fixed-point number type is relatively small , But accuracy , There is no error , It is suitable for scenes that require high accuracy ( For example, scenarios involving amount calculation )
4.3 Experience in development
5、 A type of
CREATE TABLE test_bit1{
f1 BIT,f2BIT(5); //f1 The default binary digit is 1, So only for 0 and 1,f2 Digit is 5, So you can save 0-31
}
边栏推荐
- Summer Review, we must avoid stepping on these holes!
- 5g TV cannot become a competitive advantage, and video resources become the last weapon of China's Radio and television
- 近一亿美元失窃,Horizon跨链桥被攻击事件分析
- Dialogue with ye Yanxiu, senior consultant of Longzhi and atlassian certification expert: where should Chinese users go when atlassian products enter the post server era?
- PLC模拟量输入 模拟量转换FC S_ITR (CODESYS平台)
- Is it safe to open an account online for stock speculation? Will you be cheated.
- Memory management summary
- 产品好不好,谁说了算?Sonar提出分析的性能指标,帮助您轻松判断产品性能及表现
- Width and alignment
- Exploration and practice of eventbridge in the field of SaaS enterprise integration
猜你喜欢
Dialogue with ye Yanxiu, senior consultant of Longzhi and atlassian certification expert: where should Chinese users go when atlassian products enter the post server era?
Leetcode 1200 minimum absolute difference [sort] The Path of leetcode for heroding
Techsmith Camtasia Studio 2022.0.2屏幕录制软件
音视频技术开发周刊 | 252
How to build a technical team that will bring down the company?
SAIC Maxus officially released its new brand "mifa", and its flagship product mifa 9 was officially unveiled!
深度学习 神经网络案例(手写数字识别)
一篇文章搞懂Go语言中的Context
Leecode learning notes - Joseph problem
Halcon knowledge: NCC_ Model template matching
随机推荐
Intelligent customer service track: Netease Qiyu and Weier technology play different ways
SAIC Maxus officially released its new brand "mifa", and its flagship product mifa 9 was officially unveiled!
How to build a technical team that will bring down the company?
Guitar Pro 8win10最新版吉他学习 / 打谱 / 创作
2022 financial products that can be invested
输入宽度!
%f格式符
MySQL组合索引(多列索引)使用与优化案例详解
Details of FPGA underlying resources
Analysis of nearly 100 million dollars stolen and horizon cross chain bridge attacked
Numpy notes
Redis publish and subscribe
selenium 浏览器(2)
Leetcode 1200 minimum absolute difference [sort] The Path of leetcode for heroding
如何搭建一支搞垮公司的技术团队?
UFO:微软学者提出视觉语言表征学习的统一Transformer,在多个多模态任务上达到SOTA性能!...
都在说DevOps,你真正了解它吗?
LeetCode 1184. 公交站间的距离 ---vector顺逆时针
Techsmith Camtasia Studio 2022.0.2屏幕录制软件
内存管理总结