当前位置:网站首页>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
}
边栏推荐
- PLC模拟量输入 模拟量转换FC S_ITR (CODESYS平台)
- 5G电视难成竞争优势,视频资源成中国广电最后武器
- Programmers exposed that they took private jobs: they took more than 30 orders in 10 months, with a net income of 400000
- Guitar Pro 8win10 latest guitar learning / score / creation
- 浮点数如何与0进行比较?
- Intelligent customer service track: Netease Qiyu and Weier technology play different ways
- TechSmith Camtasia studio 2022.0.2 screen recording software
- PXE网络
- lnx 高效搜索引擎、FastDeploy 推理部署工具箱、AI前沿论文 | ShowMeAI资讯日报 #07.04
- Huawei cloud database DDS products are deeply enabled
猜你喜欢
Summer Review, we must avoid stepping on these holes!
Leecode learning notes - Joseph problem
How to match chords
Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
对话龙智高级咨询顾问、Atlassian认证专家叶燕秀:Atlassian产品进入后Server时代,中国用户应当何去何从?
每周招聘|高级DBA年薪49+,机会越多,成功越近!
Helix Swarm中文包发布,Perforce进一步提升中国用户体验
IO流:节点流和处理流详细归纳。
都在说DevOps,你真正了解它吗?
Introduction to asynchronous task capability of function calculation - task trigger de duplication
随机推荐
LeetCode 35. 搜索插入位置 —vector遍历(O(logn)和O(n)的写法---二分查找法)
Ffmpeg Visual Studio development (IV): audio decoding
The performance of major mainstream programming languages is PK, and the results are unexpected
小数,指数
Ranking list of databases in July: mongodb and Oracle scores fell the most
Comment configurer un accord
MySQL组合索引(多列索引)使用与优化案例详解
PLC Analog input analog conversion FC s_ ITR (CoDeSys platform)
Weibo and Huya advance into interest communities: different paths for peers
Five minutes of machine learning every day: why do we need to normalize the characteristics of numerical types?
03 storage system
Redis 解决事务冲突之乐观锁和悲观锁
What are the concepts of union, intersection, difference and complement?
Quick introduction to automatic control principle + understanding
大神详解开源 BUFF 增益攻略丨直播
韩国AI团队抄袭震动学界!1个导师带51个学生,还是抄袭惯犯
openresty 重定向
Luo Gu - some interesting questions
UFO:微软学者提出视觉语言表征学习的统一Transformer,在多个多模态任务上达到SOTA性能!...
UFO: Microsoft scholars have proposed a unified transformer for visual language representation learning to achieve SOTA performance on multiple multimodal tasks