Skip to main content

What is a primary key?

Entry MySQL
Quick Answer Primary key uniquely identifies each row in a table. Must be unique and NOT NULL. A table can have only one primary key (but it can be a composite of multiple columns). MySQL creates a clustered index on the primary key (InnoDB) - rows are stored in primary key order. Use an integer auto_increment column as primary key for best performance in InnoDB.

Answer

A primary key uniquely identifies each row in a table and cannot be NULL. It ensures uniqueness and is used for indexing and relationships.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice