当前位置:网站首页>mysql约束之_主键约束PRIMIARY KEY
mysql约束之_主键约束PRIMIARY KEY
2022-07-22 06:00:00 【Camellia——】
-- 主键约束 primary key(特点not null+unqiue) 非空且唯一
-- 主键约束应用在非业务字段:编号id
-- 创建表的时候添加主键
CREATE TABLE stu(
id INT PRIMARY KEY, -- 主键
NAME VARCHAR(20)
);
-- 插入数据
INSERT INTO stu(id,NAME)VALUES(1,'张三'),(2,'李四');
-- 删除主键 drop PRIMARY KEY:可以重复但依然不能为空,not null 约束不会随着主键的删除而重复
ALTER TABLE stu DROP PRIMARY KEY;
边栏推荐
- LVS, this is enough
- NVIDIA hardware architecture
- UE4 combines the objects made by the brush into a whole
- The three formats of the log "binlog" in MySQL are so interesting
- [paper translation] generalized radio representation learning via cross supervision between images
- Angr principle and Practice (I) -- principle
- QT warning: c4819: this file contains characters that cannot be represented in the current code page (936). Please save the file in Unicode format to prevent data loss
- 【外部排序】归并思想完成外部排序
- UE4 set night (update skysphere according to directionallight direction)
- Make good use of these seven tips in code review, and it is easy to establish your opposition alliance
猜你喜欢
随机推荐
@The difference between resource and @autowired
Nvidia 硬件架构
14 multithread 1
Lepton 无损压缩原理及性能分析
GMT 0009-2012 data format go language operation
Server network performance tuning cases
The three formats of the log "binlog" in MySQL are so interesting
Win11闪白屏无法控制如何解决?
15_ Additional models
从0到1建设智能灰度数据体系:以vivo游戏中心为例
分支语句和循环语句
服务器buffer/cache 的产生原因和释放buffer/cache
注意力机制的分类
Apache自带的ab压力测试工具如何实现
2022/7/19-日报
Tutorial update 20220719
UE4 面试基础知识(三)
接招吧。最强“高并发”系统设计 46 连问,分分钟秒杀一众面试者
Ffmpeg-rk3399 ffplay learning analysis
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example