SQL query1
SQL query1
Different
Types of Keys
in Databases
and Their
Uses
Pradeep M
@pradeep-m-analyst
1
Primary Key
It’s like a unique ID for each row in a table.
Foreign Key
A foreign key links a table to another table
by referencing its primary key, creating
relationships.
Composite Key
When a single column isn't enough to
uniquely identify a record, we combine
two or more columns.
Super Key
Any group of columns in a super key can
uniquely identify a record, but only one
becomes the primary key.
Candidate Key
Like a contender for primary key, a
candidate key is unique but might not be
the chosen one.
Unique Key
Similar to a primary key, a unique key
ensures no duplicates, but allows one
record to be missing a value.
Alternate Key
This is a backup option for unique
identification within a table, offering
flexibility.
Natural Key
This is a key that naturally identifies a row.
Surrogate Key
When there's no natural unique identifier,
we create an artificial key.
Secondary Key
These don't identify records directly, but
act like helpful indexes to speed up
searches.
Pradeep M
@pradeep-m-analyst