3.2. UNIQUE
In this section we use a table that stores student information. The table description is:
Name Null? Type ------------------------------ -------- ------------ STUDENT_ID VARCHAR2(10) STUDENT_NAME VARCHAR2(30) COLLEGE_MAJOR VARCHAR2(15) STATUS VARCHAR2(15) STATE VARCHAR2(2) LICENSE_NO VARCHAR2(30)
The UNIQUE constraint is applied to a column, or set of columns, to enforce the following rule: If a value exists, than that value must be unique.
This definition sounds similar to a PRIMARY KEY constraint. The following is a comparison between the primary key and unique constraints.
A table can have just one primary key constraint but a table can have more than one unique constraint.
A column that is part of a primary key can never have ...
Get Programming Oracle® Triggers and Stored Procedures, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.