cancel
Showing results for 
Search instead for 
Did you mean: 

Diff primary key and secondary key

Former Member
0 Kudos

Hi Gurus,

in table's there is key like primary and secondry?. what is the difference between primary key and secondary key.

Accepted Solutions (0)

Answers (3)

Answers (3)

Lakshmipathi
Active Contributor
0 Kudos

Primary key

The field which is Unique and not null is called the Primary Key field

Foreign Key

To establish the relations between 2 tables the same key field in another table is the Foreign key. Foreign key may or may not be Unique and not-null.

thanks

G. Lakshmipathi

Former Member
0 Kudos

Hi nareshkumar,

Primary key

If no WITH key declaration is made, a table type is generic with respect to the primary key.

If a declaration about the uniqueness of the key is not made in key, a table type is partially generic with respect to the key.

If a key declaration with a uniqueness declaration is made in key, a table type is not generic with respect to the primary key.

The non-generic table categories can be split up as follows:

If no primary key is declared for standard tables, this primary key is generic with respect to the key fields and defined implicitly as non-unique.

If no primary key is declared for sorted tables, this primary key is generic with respect to the key fields and uniqueness.

If no primary key is declared for hashed tables, this primary key is generic with respect to the key fields and uniqueness; note, however, that fixed hash tables can have only one unique key.

Secondary key

The genericness of a table type with respect to the secondary key depends (by default) on the genericness of the primary key; you can override it with the WITH|WITHOUT FURTHER SECONDARY KEYS additions.

If the primary key is completely or partially generic, then the table type is by default generic with respect to the secondary key. The standard response can be expressed using the WITH FURTHER SECONDARY KEYS addition. However, if the WITHOUT FURTHER SECONDARY KEYS addition is declared, the table type is generic with respect to the primary key but not with respect to the secondary key.

If the primary key is not generic, then the table type is not generic with respect to the secondary key either (by default). The standard response can be expressed using the WITHOUT FURTHER SECONDARY KEYS addition. If, however, the WITH FURTHER SECONDARY KEYS is declared, the table type is generic with respect to the secondary key but not with respect to the primary key.

Thanks,

Swamy H P

Former Member
0 Kudos