English

What is the importance of primary key in a table? Explain with suitable example.

Advertisements
Advertisements

Question

What is the importance of primary key in a table? Explain with suitable example.

Explain
Advertisements

Solution

Importance of a primary key

  1. It uniquely identifies every row in a table.
  2. It prevents duplicate values and maintains data integrity.
  3. It does not allow NULL values.
  4. It helps establish relationships between tables.
  5. It makes searching and referencing records easier.

Example: In a Student table, AdNo can be the primary key because every student has a unique admission number. Thus, the record with AdNo = 101 can be identified without confusion.

shaalaa.com
  Is there an error in this question or solution?
Chapter 9: Databases Concepts and SQL - EXERCISE [Page 173]

APPEARS IN

CBSE Computer Science with Python [English] Class 12
Chapter 9 Databases Concepts and SQL
EXERCISE | Q 14. | Page 173
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×