Keys in sql

Primary key or natural key – which has mapping to the someone in the real-world scenario that is not in database. Uniquely identifies a record in a table. Cannot be NULL.

For eg : ssn _number


Foreign Key
-  A field in one table that refers to the primary key in another.

Surrogate key is again a primary key, but it has not mapped to anything in the real world, which is key only in database. “Numeric number “.

Composite key: - when we have multiple columns need to identify each row of records, then the primary key is a composite key.


 

No comments:

Post a Comment

Most Recent posts

Copy and Modify Stages

In IBM Infosphere DataStage , both Copy Stage and Modify Stage are simple processing stages used in parallel jobs , but their purpose i...