Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unique key

Former Member
0 Likes
682

Hi Experts,

What is the difference between a Primary key and Unique in ABAP?

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
642

Hi

The primary key is the key obtained by all key fields, an unique key is a key created by several fields (they can be or not be key fields) and the key has to be unique.

So the primary key is always unique key a secondary index could be unique, but generally it isn't.

Max

4 REPLIES 4
Read only

Former Member
0 Likes
643

Hi

The primary key is the key obtained by all key fields, an unique key is a key created by several fields (they can be or not be key fields) and the key has to be unique.

So the primary key is always unique key a secondary index could be unique, but generally it isn't.

Max

Read only

anversha_s
Active Contributor
0 Likes
642

Hi

1. This concept of primary key and unique key

comes into picture at the database level

(especially oracle)

2. The only difference is that

unique key allows

insertion of a NULL value

into the key field(s)

Where as primary key does not allow.

3. Similary is ;

Both maintain unique/distinct values

in the table.

I hope it helps.

regards,

Anver

Read only

0 Likes
642

Hi All,

Thanks.

Read only

Former Member
0 Likes
642

Hi Ravi,

Primary Key = Not Null + Unique(You cannot store empty or null values into Primary key)

Unique Key = You can store one empty value along with other unique values.

Simply, if your field is Primary key , you cannot insert a duplicate or a empty value into it.

But if it is unique then you can inser one empty value but it should not be duplicate.

Regards,

Raghav