Primary Key
A primary key is a unique identifier value for a database record in a table. It is typically a number, often generated sequentially as the database creates new records, but text strings may also be used as primary keys if they are guaranteed to be unique. Relational databases use primary keys to create links between records across separate tables.
When you create a table, you have several options for assigning primary keys. First, you may choose a primary key from existing information in the record, like a customer phone number or Social Security Number; this kind of primary key is called a "natural key." A "surrogate key," on the other hand, is a value generated solely to serve as the primary key. A DBMS can generate a surrogate key sequentially as it adds new records, or generate a random number or UUID instead. If a DMBS must delete a record, it usually preserves that record's primary key and will not reuse it.
Relational databases use primary keys to ensure that each record in a table is unique and to create links between records across tables. For example, a customer database could include a Customer Identification table with names and email addresses, and another Shipping Address table with street addresses. The Customer Identification table might use a generated UUID in the Customer ID field as a primary key, allowing customers to update their name without changing how the DBMS references that record. The Shipping Address table, meanwhile, saves every shipping address in the system as a separate record with a sequential ID number that increments with each new address. This allows a record in the Customer Identification table to associate each customer record with one or more addresses, using the primary key from the address table as a foreign key within a customer record.