当前位置:网站首页>Introduction and advanced level of MySQL (6)
Introduction and advanced level of MySQL (6)
2022-07-28 18:43:00 【Xiaoxinai programming】
Catalog
1、 constraint
When we create database tables
CREATE TABLE Table name (
Name type [ constraint ],
Name type [ constraint ]
)
2、 Constraint classification
2.1、primary key
Primary key constraint When a column is created add to primary key here The primary key constraint is added to this column , This column is called Primary key column . for example
Create table student (
id int primary key
)
here id This column adds a primary key constraint , This column is called Primary key column .
When added After the primary key constraint , At this time, this column is not empty ( This column must have a value ) And only ( The value of each row of this column cannot be repeated ) The limit of .
doubt : Can I use unique + not null Instead of primary key ?
Can not be , because primary key Except for non empty and unique restrictions , Another function is Functions of primary key index .
I'm interested in studying binary trees ( No need to know the code )
therefore Our database tables all have one id Column Set as primary key constraint
2.2、AUTO_INCREMENT( Self growth )
2.3、DEFAULT( Default )
2.4、unique Represents the only constraint .
The only constraint is to specify table Column or column combination of cannot be repeated , Guarantee the uniqueness of data
2.5、not null Is a non empty constraint ,
The value of a specified row cannot be null.
3、SQL Import and export of files
export : Select database –》 Right click —》 Transfer to storage SQL --》 preservation
Import :
4、MYSQL data type
TINYINT 1 Bytes (-128,127) (0,255) Small integer value
SMALLINT 2 Bytes (-32 768,32 767) (0,65 535) Large integer value
MEDIUMINT 3 Bytes (-8 388 608,8 388 607) (0,16 777 215) Large integer value
INT or INTEGER 4 Bytes (-2 147 483 648,2 147 483 647) (0,4 294 967 295) Large integer value
BIGINT 8 Bytes (-9,223,372,036,854,775,808,9 223 372 036 854 775 807) (0,18 446 744 073 709 551 615) Maximum integer value
FLOAT 4 Bytes (-3.402 823 466 E+38,-1.175 494 351 E-38),0,(1.175 494 351 E-38,3.402 823 466 351 E+38) 0,(1.175 494 351 E-38,3.402 823 466 E+38) Single precision floating point values
DOUBLE 8 Bytes (-1.797 693 134 862 315 7 E+308,-2.225 073 858 507 201 4 E-308),0,(2.225 073 858 507 201 4 E-308,1.797 693 134 862 315 7 E+308) 0,(2.225 073 858 507 201 4 E-308,1.797 693 134 862 315 7 E+308) Double precision floating point value
DECIMAL Yes DECIMAL(M,D) , If M>D, by M+2 Otherwise D+2 Depend on M and D Value Depend on M and D Value Small value 
边栏推荐
- Zen project management software is an indispensable tool for agile development teams
- Ue5 gas learning notes 0.1 case Preview
- Software testing needs more and more talents, but fewer people are on the road of testing?
- LeetCode_343_整数拆分
- Is the training institution of software testing reliable
- Golang concurrency model
- 高德地图实现自定义小蓝点 自定义点标记 绘制多边形/圆形区域 根据地图的移动显示或者隐藏自定义点标记的相关实现
- 实验楼----PHP大法
- Syntax error: non declaration statement outside function bodygo and syntax error: unexpected {, expect
- What are the conditions for zero foundation learning software testing?
猜你喜欢

2022-07-27 第四小组 修身课 学习笔记(every day)

NPM cannot recognize the "NPM" item as the name of a cmdlet, function, script file, or runnable program. Please check the spelling of the name. If the path is included, make sure the path is correct,

MYSQL入门与进阶(六)

Introduction to advanced design system (ads) 2009 RF simulation

Six countries in Europe and the United States launched an express line product to optimize the "end-to-end" performance service on the 5th

1.1、稀疏数组

MYSQL入门与进阶(五)

Noise of creative coding

苹果开发完整的苹果证书与描述文件创建流程

Principle, classification and requirements of antenna
随机推荐
UE5 GAS 学习笔记8.0参考资料
Docker builds MySQL master-slave replication
NPM cannot recognize the "NPM" item as the name of a cmdlet, function, script file, or runnable program. Please check the spelling of the name. If the path is included, make sure the path is correct,
Implementation of solid transfer function (based on transfer)
从 SRE 看 DevOps 建设
MySQL advanced mvcc (ultra detailed collation)
UE5 GAS 学习笔记0.2配置插件
Leetcode79 method 1: deep search
SQL Server stuff and for XML path
有一种密码学专用语言叫做ASN.1
Brief introduction to the principle of spectrometer II
LeetCode_343_整数拆分
UE5 GAS 学习笔记 1.5 Gameplay Effects游戏效果
What is the employment prospect of software testing?
Mingde biology: no products of the company have been listed in the WHO recommended list
1.1、稀疏数组
UE5 GAS 学习笔记 1.8 游戏特效(GameplayCue)
深圳线下报名|StarRocks on AWS:如何对实时数仓进行极速统一分析
UE5 GAS 学习笔记 1.7 任务Ability Tasks
Ue5 gas learning notes 1.7 task ability tasks