MockReal Logo
Home
BlogPricing
For Employers β†’
  1. Home
  2. Questions
  3. Primary vs Composite vs Unique Key

Primary vs Composite vs Unique Key

Technicalsenior full stack .net and angularSenior Full Stack .NET DeveloperFull Stack DeveloperDatabase AdministratorSoftware Engineer

A primary key uniquely identifies each record in a table and cannot contain NULL values. A composite key consists of two or more columns that together uniquely identify a record, which is useful for complex relationships. A unique key ensures all values in a column are distinct, but it can contain NULL values.

For example, in a user table, the primary key could be the user ID, while a composite key might be a combination of first name and last name for a specific context. Unique keys are great for fields like email addresses.

More Questions

  • Count Students Across Subjects?
  • DROP vs DELETE vs TRUNCATE?
  • EF Core Migration?
  • IEnumerable vs IQueryable?
  • SQL JOIN Example?
  • Angular Lifecycle Hooks?
  • Angular vs AngularJS?
  • Authentication vs Authorization?
  • Country-State Dropdown?
  • Count Vowels?
MockReal Logo

Spoken interview practice for technical professionals

Product

  • Pricing
  • Questions
  • Positions
  • Resumes
  • For Employers β†’

Company

  • Careers
  • About Us
  • Contact
  • Blog

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy

Β© 2025 MockReal. Spoken interview practice. All rights reserved.