Files
mysql-press/docs/mysql/primaryKey.md
2021-05-08 11:03:38 +08:00

18 lines
664 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 主键
> 在之前的操作中我们进行了增删改查,并没有出现什么问题,但是有一个很大的问题,前面的姓名。年龄,性别都是有可能重复的,我们没有办法准确的确定到一个人,比如下面这种情况。
## primary key
先看一下现在表中的数据。
![图 4](../../images/4874f36184f21487e8bf5a353f8c9416d2db19b3f37dc98ab1687afceac80ac3.png)
现在表中还有李四和小名这两个人但是这个班级中又来了一个转校生名字也叫李四性别也是男但是年龄是21。
先添加这么一个人
```sql
insert into class(name,sex,age) value("李四","",21);
```