【发布时间】:2016-12-01 03:50:40
【问题描述】:
在 mysql 中,说我有:
create table users(
id not null
)
假设我需要将 id 作为主键。有什么区别:
create table users(
id primary key not null
)
和
create table users(
id not null
primary key (id))
和
create table users(
id not null
constraint pk primary key (id))
在这种情况下,我一直在寻找约束的含义,但我只找到了如何使用它们,而不是它实际上是什么。
【问题讨论】:
标签: mysql constraints primary-key