sandy_liao

SQL UNIQUE Constraint

The UNIQUE constraint uniquely identifies each record in a database table.

The UNIQUE and PRIMARY KEY constraints both provide a guarantee for uniqueness for a column or set of columns.

A PRIMARY KEY constraint automatically has a UNIQUE constraint defined on it.

Note that you can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table.

 

CREATE TABLE Persons
(
xx_xx int NOT NULL,
xx varchar(255) NOT NULL,
xxxx varchar(255),
xx varchar(255),
xxx varchar(255),
CONSTRAINT xx_xx UNIQUE (x_xx,xxxx)
)

 

ALTER TABLE xxx
ADD CONSTRAINT uc_PersonID UNIQUE (xxx_xxx,xxx)
 

分类:

技术点:

相关文章:

  • 2021-11-08
  • 2021-09-11
  • 2021-09-11
  • 2021-08-01
  • 2021-09-11
  • 2021-08-23
  • 2021-09-11
猜你喜欢
  • 2021-04-27
  • 2021-09-11
  • 2021-09-11
  • 2021-09-11
  • 2021-09-11
  • 2021-09-11
  • 2022-03-07
相关资源
相似解决方案