当前位置:网站首页>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
}
边栏推荐
- Five minutes per day machine learning: use gradient descent to complete the fitting of multi feature linear regression model
- 音视频技术开发周刊 | 252
- 输入宽度!
- When synchronized encounters this thing, there is a big hole, pay attention!
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- 对话龙智高级咨询顾问、Atlassian认证专家叶燕秀:Atlassian产品进入后Server时代,中国用户应当何去何从?
- 数据库函数的用法「建议收藏」
- Deep learning network regularization
- Hexadecimal form
- 找数字
猜你喜欢
深度学习 神经网络的优化方法
Who the final say whether the product is good or not? Sonar puts forward performance indicators for analysis to help you easily judge product performance and performance
How did the beyond concert 31 years ago get super clean and repaired?
I plan to teach myself some programming and want to work as a part-time programmer. I want to ask which programmer has a simple part-time platform list and doesn't investigate the degree of the receiv
How to build a technical team that will bring down the company?
【大连理工大学】考研初试复试资料分享
Five minutes of machine learning every day: why do we need to normalize the characteristics of numerical types?
Weibo and Huya advance into interest communities: different paths for peers
Deep learning neural network case (handwritten digit recognition)
Flutter reports an error no mediaquery widget ancestor found
随机推荐
LeetCode 1200 最小絕對差[排序] HERODING的LeetCode之路
Redis 發布和訂閱
CentOS 6.3 下 PHP编译安装JSON模块报错解决
Helix Swarm中文包发布,Perforce进一步提升中国用户体验
函数计算异步任务能力介绍 - 任务触发去重
左右对齐!
一篇文章搞懂Go语言中的Context
Guitar Pro 8win10最新版吉他学习 / 打谱 / 创作
LeetCode 1200 最小绝对差[排序] HERODING的LeetCode之路
UFO: Microsoft scholars have proposed a unified transformer for visual language representation learning to achieve SOTA performance on multiple multimodal tasks
2022 financial products that can be invested
输入宽度!
金额计算用 BigDecimal 就万无一失了?看看这五个坑吧~~
I plan to teach myself some programming and want to work as a part-time programmer. I want to ask which programmer has a simple part-time platform list and doesn't investigate the degree of the receiv
智能客服赛道:网易七鱼、微洱科技打法迥异
On the implementation plan of MySQL explain
Preliminary exploration of flask: WSGI
Redis publish and subscribe
numpy笔记
Helix swarm Chinese package is released, and perforce further improves the user experience in China