What is a primary key in a database, and why is it important?

1 Answers
Answered by suresh

```html

Interview Question: What is a Primary Key in a Database and Why is it Important?

What is a Primary Key in a Database and Why is it Important?

A primary key is a unique identifier for each record in a database table. It ensures that each record can be uniquely identified and helps maintain data integrity by preventing duplicate entries.

Primary keys are important in a database because they serve as a reference point for relationships between different tables. They also help in optimizing query performance by allowing for quicker retrieval of data through indexing.

Overall, the primary key plays a crucial role in ensuring the accuracy, consistency, and efficiency of a database system.

```

Answer for Question: What is a primary key in a database, and why is it important?