oracle primary key | Primary Key - oracle tutorial - sql tutorial
Learn oracle - oracle tutorial - Oracle create table with only primary key - oracle examples - oracle programs
What is oracle primary key ?
- A primary key is a single field or combination of fields that uniquely defines a record.
- A primary key column cannot contain NULL values.
- Most tables should have a primary key, and each table can have only ONE primary key.
Oracle primary key and foreign key
Syntax:
Learn oracle - oracle tutorial - Oracle constrains primary key - oracle examples - oracle programs
oracle tutorial , sql tutorial , sql , pl sql tutorial , oracle , pl sql , plsql
Example:
Creating Primary key in the Table:
- In the create table statement, PRIMARY KEY constraint is applied for emp_id column.
- We are inserting id value 1, name value as ARUN and designation value as project manager into a wikitechy_emp table using insert into keyword.
- Here, when we insert a same value for emp_id which you have already inserted in your first row. The unique constraint (PRIMARY KEY) reject your insertion of data into the wikitechy_emp table and shows a violated message.