# Composite Keys

> What is a composite primary key? When would you use one instead of a single surrogate ID column?

Canonical: https://www.internhack.in/learn/interview/database-design/db-composite-primary-key
Last updated: 2026-11-28

Difficulty: Beginner

## Question

What is a composite primary key? When would you use one instead of a single surrogate ID column?

*The full answer is for InternHack members. Open the page link above to read it.*

## Concepts covered

Composite Key, Primary Key, Junction Table, Column Order, Leftmost Prefix

Previous: [Referential Integrity](https://www.internhack.in/learn/interview/database-design/db-foreign-key-constraints) · Next: [Stored Procedures](https://www.internhack.in/learn/interview/database-design/db-stored-procedures-pros-cons) · [All of Database Design](https://www.internhack.in/learn/interview/database-design)

## More Database Design questions

- [Denormalization](https://www.internhack.in/learn/interview/database-design/db-denormalization-use-case)
- [Views vs. Materialized Views](https://www.internhack.in/learn/interview/database-design/db-view-vs-materialized-view)
- [Concurrency Control](https://www.internhack.in/learn/interview/database-design/db-optimistic-vs-pessimistic-locking)
- [B-Tree vs Hash Index](https://www.internhack.in/learn/interview/database-design/db-btree-vs-hash-indexing)
- [Deadlock Prevention](https://www.internhack.in/learn/interview/database-design/db-deadlock-prevention)
- [Surrogate vs. Natural Keys](https://www.internhack.in/learn/interview/database-design/db-surrogate-vs-natural-key)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Database Design](https://www.internhack.in/learn/interview/database-design)
