Oracle Unique | Unique - oracle tutorial - sql tutorial
Learn oracle - oracle tutorial - Oracle unique - oracle examples - oracle programs
What is unique constraint in oracle ?
- A unique constraint is a single field or combination of fields that uniquely defines a record.
- Some of the fields can contain null values as long as the combination of values is unique.
Difference Between Primary Key and Unique Key:
Primary Key:
- None of the fields that are part of the primary key can contain a null value.
Unique Key:
- Some of the fields that are part of the unique constraint can contain null values as long as the combination of values is unique.
oracle tutorial , sql tutorial , sql , pl sql tutorial , oracle , pl sql , plsql
Syntax
Parameters or Arguments
table_name
- The name of the table that you wish to create.
column1, column2
- The columns that you wish to create in the table
constraint_name
- The name of the unique constraint.
uc_col1, uc_col2, ... uc_col_n
- The columns that make up the unique constraint.
Example
- Insert the values in the wikitechy_emp table by using INSERT Statement.
- .
- Click Run button to execute the query.
- We can see the row which has been successfully inserted in the wikitech_emp table
Disable:
Syntax
- ALTER TABLE table_name DISABLE CONSTRAINT constraint_name;