Primary Keys
Exam code: 2210
Primary Keys
Primary Keys
What is a primary key?
A primary key is a unique field that can be used to identify a record in a table
customer_id is the primary key for the customers table below
Other examples of primary keys in database tables would include:
Student_ID in a school database
Car_Registration in a car database
Product_ID in a shop database
CustomerID | FirstName | LastName | DOB | PhoneNumber |
|---|---|---|---|---|
001 | Andrea | Bycroft | 05031976 | 0746762883 |
002 | Melissa | Langler | 22012001 | 0756372892 |
003 | Amy | George | 22111988 | 074637 |
Key database terminology
Term | Definition |
|---|---|
Table | A collection of records with a similar structure |
Record | A group of related fields, representing one data entry |
Field | A single piece of data in a record |
Data type | Type of data held in a field |
Primary key | A unique identifier for each record in a table, usually an ID number |