首页 > 技术文章 > CHIL-ORACLE-唯一约束(unique)

ChineseIntelligentLanguage 2017-03-07 10:09 原文

唯一约束
  要求该列唯一,允许为空,但只能出现一个空值
1
.唯一约束 ( unique ) --例如1: create table test19( id number , name varchar2(30) , address varchar2(30) , primary key(id) , unique(address) ); ---例如2: create table test20( id number primary key , name varchar2(30) , address varchar2(30) unique ); --例如3: create table test21( id number primary key , name varchar2(30) , address varchar2(30) ); --给建好的表加上唯一约束 ALTER TABLE test21 ADD unique(address);

 

推荐阅读