Home > Database > Mysql Tutorial > MySQL数据库设计之各种INTEGER类型最佳实践_MySQL

MySQL数据库设计之各种INTEGER类型最佳实践_MySQL

WBOY
Release: 2016-05-30 17:11:28
Original
1757 people have browsed it
MySQL 各种 INTEGER 类型占用存储空间、取值范围一览表
MySQL 各种 INTEGER 类型占用存储空间、取值范围一览表.png
最佳实践
UNSIGNED 只能存储非负整数SIGNED 可以存储正整数、0、负整数对于总是正整数的存储(比如主键)的最佳实践是 UNSIGNED,因为这时它占用和 SIGNED 一样的存储空间,但取值范围多出一倍BOOL、BOOLEAN 只不过是 TINYINT(1) 的另外一种写法而已TINYINT(1)、BOOL、BOOLEAN 所占用的存储空间和 TINYINT 一样,都是一个字节,而不是一位TINYINT(1) 所能存储的值的范围和 TINYINT 一样,都是 -128 到 127TINYINT(1) 只是在显示的时候作为一个位进行输出而已
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template