Database
Database
Database Keys
A unique identifier for
each record in a table,
used to enforce entity
integrity.
Primary Key…
Foreign Key…
Establishes a relationship
between tables, refers to a
primary key in another
table.
Made up of multiple
columns, used when a
single column can't
uniquely identify a record.
Composite Key
EXAMPLE:
• The "Students" table has several columns:
Student ID
First Name
Last Name
Email Address
Phone Number
WHY DO WE
NEED KEYS IN A
DATABASE?
UNIQUE
IDENTIFICATION
Keys provide a unique identifier for each record
in a table. This allows the database to distinguish
between records and ensures that each record is
referenced accurately.
DATA SECURITY
& INTEGRITY
Keys help to maintain the integrity of the data by enforcing
relationships between tables and preventing duplicate data. Keys are
used to control access to data by granting or denying access
to specific records or tables.
Referential Integrity:
Keys provide a unique identifier for each
record in a table. This allows the database to
distinguish between records and ensures
that each record is referenced accurately.
Task:
- Identify the primary key for
each table.