Why we have to use when define a primary key with not null. Because I know that primary also includes uniquness of the column | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we have to use when define a primary key with not null. Because I know that primary also includes uniquness of the column

Constraints

4th Jul 2020, 4:35 PM
AYŞE DUMAN
2 Answers
0
most of the dbms will automaticly set a PK to NOT NULL, so you dont really need to specify NOT NULL a story for pratical side of it i've heard a story of a man with NULL custom license plate for his car. but unknowningly he kept getting traffic ticket, which not his. he havent done any violation, but the ticket keep piling up and he need to pay for it. turns out whenever any officer forget to record the plate number into the system, it'll be saved as NULL in the database. NULL as a key in that case really cause an unexpected behavior of the system, and cause quite a monetary loss for someone
4th Jul 2020, 4:49 PM
Taste
Taste - avatar
0
Thank u for clearly explanation
4th Jul 2020, 4:57 PM
AYŞE DUMAN