0
$\begingroup$

After reading a lot of materials related to the Primary key and Unique key, I am in doubt. Let us consider a primary key (AB) in table R (ABCDE). AB together can not be null as AB is a primary key. But, is it possible for a row that A is null? Or, B is null?

$\endgroup$
3
  • $\begingroup$ yes, It is possible for "either" of them to be null but not both as both being null would make the primary key null. This further depends on whether A and B allow null values or not $\endgroup$
    – Rinkesh P
    Mar 14, 2022 at 13:21
  • $\begingroup$ Thank you @RinkeshP, but then it is going to be the same with a unique key or not? Am I wrong? $\endgroup$
    – A Paul
    Mar 14, 2022 at 14:16
  • $\begingroup$ A unique key would allow at most 1 null value but a primary key won't allow null at all. $\endgroup$
    – Rinkesh P
    Mar 14, 2022 at 14:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.