Prepare for the A Level Computer Science OCR Exam with essential tips and insights! Tailored quizzes, comprehensive resources, and effective study strategies await you. Get ready to ace your exam!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What is the function of a primary key in a database?

  1. A field that contains duplicate entries

  2. A field that uniquely identifies a record in a table

  3. A field used solely for user interface purposes

  4. A field that can link to external data sources

The correct answer is: A field that uniquely identifies a record in a table

A primary key serves as a critical component in a database by ensuring that each record within a table is uniquely identifiable. This uniqueness is essential for maintaining data integrity and facilitating efficient data retrieval and manipulation. By designating a primary key for a table, you enable the database management system to distinguish between different records and prevent any ambiguity that could arise from duplicate data. For example, in a table containing user information, the primary key might be the user's ID number. This ensures that even if two users have the same name, each record can still be accessed and managed individually without confusion. The primary key also establishes relationships between tables, which is fundamental in relational databases, as it helps organize and reference data effectively across different tables. Thus, option B accurately defines the primary key's essential role in database design and functionality.