Question:
I need to understand how to add a unique constraint statement to
make sure that all rows have distinct values. How do you alter a
unique constraint column value to make it into a primary key constraint?
Unique Constraints
Unique constraints are like alternative primary key
constraints.
- A unique constraint defines a column, or series of columns, that
must be unique in value.
- You can have a number of unique constraints defined and
the columns can have NULL values in them, unlike a column that belongs to a
primary key constraint.
- If you need to add unique key constraints to a table
after the fact, simply use the alter table command.
ALTER TABLE
my_status
ADD CONSTRAINT
uk_my_status
UNIQUE
(status_id,
person_id);
Normally, a unique constreaint is the same functinally as a unique
index.
|
|
Get the Complete
Oracle SQL Tuning Information
The landmark book
"Advanced Oracle
SQL Tuning The Definitive Reference" is
filled with valuable information on Oracle SQL Tuning.
This book includes scripts and tools to hypercharge Oracle 11g
performance and you can
buy it
for 30% off directly from the publisher.
|