当前位置:网站首页>MySQL digital type learning notes
MySQL digital type learning notes
2022-07-05 10:08:00 【51CTO】
Numeric type
Recently in to see 《MySQL Technology insider :SQL Programming 》 And made notes , So this blog is a blog of note type , Share it for your review , Can also help others
- integer
type | Occupancy space | minimum value (SIGNED) | Maximum (SIGNED) | minimum value (UNSIGNED) | Maximum (UNSIGNED) |
TINYINT | 1 | -128 | 127 | 0 | 255 |
SMALLINT | 2 | -32768 | 32767 | 0 | 65535 |
MEDIUMINT | 3 | -8388608 | 8388607 | 0 | 16777215 |
INT | 4 | -2147483648 | 2147483647 | 0 | 4294967295 |
BIGINT | 8 | -9223372036854775808 | 9223372036854775808 | 0 | 18446744073709551615 |
- A type of
A type of , Keywords are bit, The bit type is used to store the value of the bit field ,BIT(M),M Indicates the value of the number of bits allowed to be stored ,M For the range of 1 To 64, The space occupied is (M+7)/8 byte
Be careful : If the length of the assigned value is less than M position , Use it on the left of the value 0 fill
# Create a table
CREATE TABLE t(a BIT(4));
# Write data
INSERT INTO t SELECT b'1000';
# Inquire about , Display the string in the new version , You can't check it directly
SELECT * FROM t;
# Bit type , It can be used HEX function , The result is a number 8(16 Base number )
SELECT HEX(a) FROM t;
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- floating-point ( Imprecise type )
MySQL Two floating point types are supported : Single precision FLOAT Type and double precision DOUBLE type - High precision type
DECIMAL and NUMERIC yes MySQL Types with relatively high progress , Grammar is DECIMAL(M,N)、NUMERIC(M,N),M Representation precision , That is, the number of digits of the whole value ,, Two types of maximum digits M All for 65,N Indicates the scale , That is, the number of digits after the decimal point of the whole value
边栏推荐
- Kotlin compose multiple item scrolling
- Wechat applet - simple diet recommendation (4)
- How Windows bat script automatically executes sqlcipher command
- Comparison of batch merge between Oracle and MySQL
- 90%的人都不懂的泛型,泛型的缺陷和应用场景
- Android SQLite database encryption
- RMS to EAP is simply implemented through mqtt
- Matrix processing practice
- 为什么不建议你用 MongoDB 这类产品替代时序数据库?
- Analysis on the wallet system architecture of Baidu trading platform
猜你喜欢
Hard core, have you ever seen robots play "escape from the secret room"? (code attached)
Develop and implement movie recommendation applet based on wechat cloud
Roll up, break through 35 year old anxiety, and animate the CPU to record the function call process
[tips] get the x-axis and y-axis values of cdfplot function in MATLAB
mysql80服务不启动
Kotlin Compose 与原生 嵌套使用
Charm of code language
Node-RED系列(二九):使用slider与chart节点来实现双折线时间序列图
Comment obtenir le temps STW du GC (collecteur d'ordures)?
RMS TO EAP通过MQTT简单实现
随机推荐
Cent7 Oracle database installation error
The king of pirated Dall · e? 50000 images per day, crowded hugging face server, and openai ordered to change its name
How to correctly evaluate video image quality
cent7安装Oracle数据库报错
La voie de l'évolution du système intelligent d'inspection et d'ordonnancement des petites procédures de Baidu
盗版DALL·E成梗图之王?日产5万张图像,挤爆抱抱脸服务器,OpenAI勒令改名
Matrix processing practice
Apache dolphin scheduler system architecture design
The popularity of B2B2C continues to rise. What are the benefits of enterprises doing multi-user mall system?
Flutter development: a way to solve the problem of blank space on the top of listview
How to get the STW (pause) time of GC (garbage collector)?
写入速度提升数十倍,TDengine 在拓斯达智能工厂解决方案上的应用
搞数据库是不是越老越吃香?
About getfragmentmanager () and getchildfragmentmanager ()
Why does everyone want to do e-commerce? How much do you know about the advantages of online shopping malls?
[technical live broadcast] how to rewrite tdengine code from 0 to 1 with vscode
How to implement complex SQL such as distributed database sub query and join?
双容水箱液位模糊PID控制系统设计与仿真(Matlab/Simulink)
天龙八部TLBB系列 - 关于包裹掉落的物品
【小技巧】獲取matlab中cdfplot函數的x軸,y軸的數值