当前位置:网站首页>Data types and constraints
Data types and constraints
2022-07-16 05:19:00 【Pony_ eighteen】
Reference article : Novice tutorial https://www.runoob.com/mysql/mysql-data-types.html
- In order to store data more accurately , Make sure the data is correct and valid , It is necessary to use data types and constraints reasonably to limit the storage of data .
MySQL The type of data field defined in is very important for database optimization .
MySQL Support for multiple types , It can be roughly divided into three categories : The number 、 date / Time and string ( character ) type .
Common data types
- Integers :int,4 Bytes ,32 position , The maximum number that can be represented is :2^32-1=4294967296, There is a range of symbols (-2147483648 ~2147483647), Unsigned range (0 ~ 4294967295)
- Double precision floating point :double,8 Bytes
- decimal :decimal, Such as decimal(5,2) It means coexistence 5 digit , Decimal share 2 position , The whole number takes up 3 position
- Small integers :tinyint,1 Bytes
- character string :varchar, Range (0~65533), Such as varchar(3) At most 3 Characters , A Chinese character or a letter takes up one character
- Date time : datetime, Range (1000-01-01 00:00:00 ~ 9999-12-31 23:59:59), Such as '2020-01-01 12:29:59'
constraint
- Primary key (primary key): The order of physical storage , Represents the unique identifier of a record , Cannot be repeated or empty .
- Non empty (not null): This field is not allowed to fill in null value
- Only (unique): Duplicate values are not allowed for this field
- The default value is (default): When this value is not filled in, the default value is used , If it is filled in, the filling shall prevail
- Foreign keys (foreign key): Maintain the association between two tables
边栏推荐
- Implementation principle and application practice of Flink CDC mongodb connector
- Ardunio -- interaction between touch sensor and light -- judge whether the light is on according to the touch screen
- <statement> or DELIMITER expected, got ‘id‘
- 【一知半解】AQS
- 指针存储数组 C
- yandexbot ip 地址段
- fenxi
- Skiasharp's WPF self drawn clock (case version)
- MVN clean or MVN clean package did not detect the test file
- 架构师进阶,微服务设计与治理的16条常用原则
猜你喜欢

Solve the problem of unable to load authentication plugin 'caching' when idea2020 connects to MySQL 8_ sha2_ Password 'exception

油猴脚本更改tw样式

Array changes, but the view cannot be updated (reason and thinking)
![[untitled]](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[untitled]

Résoudre le problème de l'échec de l'écho en temps opportun après le téléchargement de l'image du projet SSM

本周四晚19:00知识赋能第3期直播丨OpenHarmony智能家居项目之控制面板功能实现

数据操作—查询篇
Dark-blue 主题的大佬,可否加入一个打字机的功能,让打字的时候可以进行选择

看看谷歌如何在目标检测任务使用预训练权值 | CVPR 2022

Micro service mode: sidecar
随机推荐
PyTorch - 存储和加载模型
block yandex bot
数字孪生技术打造智慧矿山可视化应用
番茄定时调光台灯触摸芯片-DLT8T10S-杰力科创
Exploration and practice of integration of streaming and wholesale in jd.com
泰凌微电子B91通用开发板合入OpenHarmony社区主干
Changement de style TW du script singe huileux
c语言基础篇:N子棋
Mysql-MVCC
Mindjet MindManager adding image labels
Picture definition problem
Dynamic programming leetcode509 Fibonacci number
鸟哥谈云原生安全最佳实践 | 文末赠书
2022 GopherChina 出品人及演讲内容陆续揭晓···
数据库进阶
IE浏览器怎么查看cookie
PV operation procedure questions
抓包工具之fiddler的安装使用
yandex bot user agent
基于logisim的八位求补器的设计与实现