Last answered:

04 Jul 2024

Posted on:

01 Jul 2024

0

PRIMARY KEY is not madatory for a table?

What happens if we do not add Primary Key to the code? I tried executing and ran succesfully. Should we only add the primary key when we want to define certain relationships?

1 answers ( 0 marked as helpful)
Instructor
Posted on:

04 Jul 2024

0

Hi Rahul!

Good to hear from you.

If you don't add a primary key to an SQL table, there will be no enforcement of uniqueness, allowing duplicate rows. The database won't create implicit indexes, which could lead to slower query performance.

Without a primary key, there is no guarantee that each row can be uniquely identified, which can result in data integrity issues.

Best,

Ned

Submit an answer