Primary Key in SQL is a field in the table that helps to identify each row available in the database table in a unique manner. It consists of unique values and it cannot contain null values. Every table can contain only a single primary key that may include one or more fields. If a primary key is a combination of more than a single field then it is a composite key.
Following are some of the features and characteristics of a primary key:
- A table can contain only one primary key
- It consists of at least one column
- It enforces the integrity of the entity in the database table
- None of the columns should contain any null value
- By default, these keys result in unique and clustered indexes
To know more about primary keys, read this comprehensive SQL Tutorial.
To build a career in SQL and become proficient in it, you must sign up for SQL Training. In this course, you will work on industry-based projects that will enhance your learning and give you hands-on experience in solving real-time projects.
Also, check out this YouTube video on SQL: