What is a primary key in a relational database?
a) A key that uniquely identifies each row in a table
b) A key that allows duplicate values in a column
c) A key that is used to link two tables
d) A key that stores null values
Answer:
a) A key that uniquely identifies each row in a table
Explanation:
A primary key is a column or a set of columns that uniquely identifies each row in a table. It ensures that no duplicate rows exist, and the values in the primary key column cannot be null.
The primary key is essential for ensuring data integrity and serves as a unique identifier for records, making it easier to query, update, and manage the data.
In relational databases, primary keys play a crucial role in defining relationships between different tables through foreign keys.