Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (9k points)
What is Primary Key in SQL?

1 Answer

0 votes
by (45.3k points)

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:

Related questions

0 votes
1 answer
asked Oct 20, 2020 in SQL by dev_sk2311 (45k points)
0 votes
1 answer
asked May 3, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer
asked Apr 22, 2020 in SQL by Sudhir_1997 (55.6k points)
0 votes
1 answer

Browse Categories

...