Say it like this
- Set the user_id as the primary key
- This table is missing a primary key
- We need to drop and recreate the primary key
Use it at work
Database design
- Use a UUID as the primary key.
- Every table needs a primary key.
Debugging
- The insert failed because of a duplicate primary key.
- The primary key sequence is out of sync.
Code review
- Should the primary key be a composite key here?
- Don't expose the primary key in the URL.
Don't say this
A table can have only one primary key, though it may contain multiple columns. Use unique constraints for additional uniqueness requirements.
Don't mix it up
| Term | What it is | Who writes or uses it | When |
|---|---|---|---|
| primary key | Unique ID for each row | Developers | Every table |
| foreign key | Points to a row in another table | Developers | Linking tables |
Practice
Try it
4 quick exercises
1. Your colleague asks about table design. Which sounds most professional?
2. We should _______ the email column _______ _______ _______ for the accounts table.
3. Which sentence uses primary key incorrectly?
4. Rewrite in professional tech English: 'The thing that makes each row different in the database is called the primary key. It has to be special and cannot be empty.'
Say it out loud
Phrase 1 of 3
"Set the user_id as the primary key"
We don't save your recording. The word check uses your browser's speech recognition.
More about primary key
Real examples(3)
- in a standup
"I discovered the users table didn't have a primary key defined, so I added the user_id column as the primary key."
- in a code review
"Good catch—the primary key on the orders table should be order_id, not a composite of user_id and date."
- in a team meeting
"When we migrate to the new database, we need to ensure every table has a primary key before we import the data."
More mistakes(2)
Handle with care. Do not confuse primary key with unique key or foreign key. A primary key must be unique and cannot be null, but not all unique keys are primary keys.
- ✕The primary key in the users table can be null sometimes.✓The primary key must always have a value and can't be null.
By definition, a primary key must have a value in every row to uniquely identify that row. Null values would break this guarantee.
- ✕We use the same primary key in two different tables.✓Each table has its own primary key. Other tables reference it as a foreign key.
Primary keys are unique to their table. Other tables link to it using foreign keys, not by duplicating the primary key.
Other forms(3)
- primary key noun
"The primary key ensures each user record is unique."
- primary key constraint noun phrase
"We added a primary key constraint to the products table."
- composite primary key noun phrase
"This junction table uses a composite primary key made up of two foreign keys."
Often used with(5)
- define a primary key · To establish which column or columns serve as the primary key
- set as primary key · To designate a column as the primary key during table creation
- primary key constraint · The database rule that enforces primary key uniqueness and non-null values
- composite primary key · A primary key made up of two or more columns combined
- drop primary key · To remove the primary key from a table
Similar words(3)
- surrogate key · An artificially created primary key (like an auto-incrementing ID), different from a natural key based on real data
- unique identifier · A broader term meaning any field or set of fields that uniquely identifies a record, not necessarily the designated primary key
- natural key · A primary key based on actual data attributes (like email or username), as opposed to a surrogate key
Opposites(2)
- foreign key
- non-key column
Questions(5)
- What does primary key mean in software engineering?
- A primary key is a column or group of columns in a database table that uniquely identifies each row. It guarantees that no two rows have the same primary key value, and it cannot contain null (empty) values. Every well-designed table should have exactly one primary key.
- How do you use primary key in a sentence at work?
- In technical conversations, you might say: 'Set user_id as the primary key,' 'This table needs a primary key,' or 'The composite primary key consists of order_id and line_item_id.' It is used as a noun in database design discussions and schema documentation.
- Is primary key formal or informal?
- Primary key is a formal, technical term used in professional and academic settings. It appears in database documentation, code reviews, and technical interviews. While it is used in both spoken and written English among engineers, it is always treated as standard technical vocabulary.
- What is the difference between a primary key and a unique key?
- A primary key uniquely identifies each row and cannot be null. A unique key also ensures uniqueness but can contain null values. A table has one primary key but can have multiple unique keys.
- Can a primary key be changed after a table is created?
- Yes, you can drop the existing primary key constraint and define a new one, but this requires caution. Changing a primary key can break relationships with other tables that reference it through foreign keys, so it should be done carefully during database maintenance.



