oracle笔记 唯一性约束 (转)
一、创建唯一性约束:
alter table 表名 add constraint 约束名称 unique (列名1、列名2..)查表:SQL> desc customer;Name Type Nullable Default Comments---------------- ------------ -------- ------- --------CUSTOMER_ID NUMBERCUSTOMER_NAME VARCHAR2(20) YCUSTOMER_PHONE VARCHAR2(20) YCUSTOMER_ADDRESS VARCHAR2(50) Y添加唯一性约束:SQL> alter table customer add constraint unq_customer unique (customer_name,customer_phone);?二、修改唯一性约束:1.删除alter table customer drop constraint unq_customer;2.重命名alter table customer rename constraint unq_customer to unq_cst;3.禁用、启用alter table 表名 disable/enable constraint 约束名称;