Comments (1)
数据类型
1.整数数据类型及其取值范围:
类型 | 说明 | 存储需求(取值范围) |
---|---|---|
tinyint | 很小整数 | 1字节([0 |
smallint | 小整数 | 2字节(0 |
mediumint | 中等 | 3字节(0~16777215) ;16777215=2^24-1 |
int(integer) | 普通 | 4字节(0~4294967295) ;4294967295=2^32-1 |
bigint | 大整数 | 8字节(0~18446744073709551615);18446744073709551615=2^64-1 |
浮点数&定点数:
类型名称 | 说明 | 存储需求 |
---|---|---|
float | 单精度浮点数 | 4字节 |
double | 双精度浮点数 | 8字节 |
decimal | 压缩的“严格”定点数 | M+2字节 |
2.时间/日期类型:
year范围:19012155;‘9999-12-31 23:59:59’;
time格式:‘HH:MM:SS’(如果省略写,并且没有冒号,则默认最右起2位为秒,再到分,最后到时);
插入系统当前时间:insert into 表名 values(current_date()),(now());
date类型:‘YYYY-MM-DD’;
datetime(日期+时间):‘YYYY-MM-DD HH:MM:SS’或‘YYYYMMDDHHMMSS’,取值范围:‘1000-01-01 00:00:00’
timestamp格式同datetime,但在存储时需要4个字节(datetime需要8字节),并且以UTC(世界标准时间)进行存储(即timestamp会随设置的时区而变化,而datetime存储的绝不会变化);timestamp的范围:1970-2037。
3.字符串类型:
text类型:tinytext、text、mediumtext、longtext;
类型 | 范围 |
---|---|
tinytext | 255=2^8-1 |
text | 65535=2^16-1 |
mediumtext | 16777215=2^24-1 |
longtext | 4294967295=4GB=2^32-1 |
from blog.
Related Issues (20)
- 函数式编程记录 HOT 2
- VUE MVVM原理和实现 HOT 2
- Vue Router原理和实现
- React Redux源码
- [php] YII2学习 HOT 2
- [php] yii2 mysql HOT 2
- redux react-redux HOT 3
- 常用mysql
- [webpack ]多项目入口改造 HOT 7
- [linux] 内存清理
- lnmp服务器常见问题收集
- **所有城市经纬度坐标json以及对应的省市县3级联动json HOT 1
- 翻墙
- [linux] 日常记录
- pwa HOT 2
- 缓存一些记录 HOT 2
- npm HOT 1
- echarts 一些用法
- webpack 打包优化 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blog.