当前位置:网站首页>Is signed or unsigned selected to create an integer field in MySQL? The answer is as follows:
Is signed or unsigned selected to create an integer field in MySQL? The answer is as follows:
2022-06-13 08:22:00 【SDL Dahua】
[ recommend ] Small program version system background rapid development Recommend a real-time news interface : Suitable for news APP、 Website 、 Small program etc.
[ Words belong to excerpts ]
The symbol is “+” Plus sign and “-” minus sign ,+ No. is omitted , Positive numbers are stored in the database table , The default is not to display “+” Number , If you save a negative number , Then it will show “-” Number .
Each type of integer is unsigned (unsigned) And signed (signed) Two types of (float and double Always signed ), By default, declared integer variables are signed types (char A little special ), If you want to declare an unsigned type, you need to add... Before the type unsigned.
The difference between unsigned and signed versions is that unsigned types can save 2 Times positive integer data of signed type , such as 16 One of the bit systems smallint The range of data that can be stored is -32768~32767, and unsigned The range of data that can be stored is 0~65535.
Because in the computer , Integers are stored as complements . According to the highest order , If it is 1, A signed number is a negative number ; If it's an unsigned number , Are interpreted as positive numbers .
in addition ,unsigned If you omit the last keyword , Most compilers will think of it as unsigned int.
In short, because Int Type occupation 4 byte , That is to say 16 position ,2^16 = 65535, If there are sign bits + - Equally divided on both sides , If not, give it all +.
边栏推荐
- 微服务系统架构搭建一:环境搭建
- LVM management exercise
- HCIP_ MGRE comprehensive experiment
- Sizeof, strlen find character length
- 从零开始-实现JpetStore网站-1-建立项目框架以及项目介绍
- Did decentralized digital identity
- 4. fabric2.2 create and join channels (use the official demo)
- Determination of ranking
- MySQL queries difference sets (missing data) by linking tables based on an associated field
- Create a substrate private network
猜你喜欢
Start from scratch - implement the jpetstore website -1- establish the project framework and project introduction
AcWing 1977. 信息中继(基环树,并查集)
口碑好的食材配送信息化管理系统怎么样?
Is there any good management software to solve the problems faced by tea wholesalers
[game theory complete information static game] Nash equilibrium
Cosmos Starport installation and startup
SQL injection question type (manual injection +sqlmap)
How app inventor accesses resource files in assets directory
Dfinity (ICP) identity authentication and ledger quick start-3
Penetration problem (main directory, password explosion, database uploading Trojan horse)
随机推荐
LVM management exercise
判断一个字符串是否由另外一个字符串旋转而来
HCIP_ Static experiment
赋予代码生命力--读代码整洁之道
ERP 基础数据 概念
[game theory complete information static game] Application of Nash equilibrium
Which is the stronger fresh food distribution and sorting management system?
字符串的逆序与比较
Unity 退出编辑器模式
Edge browser uses bdtab new tab plug-in (BD new tab)
Differences between Merkle DAG and Merkle tree
Redis subscribe connection timeout interrupt problem solution
Dest0g3 520 orientation
5. fabric2.2 installation and submission contract (using official demo)
Cosmos Starport installation and startup
Mongodb test case
Cosmos star application case
Basic operation of dfinity (ICP) development-4
Buuctf web (III)
How can the small and medium-sized lighting industry make use of the digital transformation to stand out from the encirclement?