1
$\begingroup$

Assuming that we have the relationship $R(A,B,C,D)$, the tuple $(W,X,Y,NULL)$ and the following functional dependencies:

$$A \to C$$ $$A \to B,D$$

is it possible to insert a tuple with $NULL$ values, without violating the functional dependencies? I understand the definition of functional dependencies but I've never actually thought about what would happen for $NULL$ values. On the one hand, if you consider $NULL$ as a value then yes but if you say that it's the absence of value, then you can't. But in the case of the possibility of adding the tuple, mentioned above, without violating the functional dependencies, what could you do?

$\endgroup$
1
$\begingroup$

First of all, the classical relational theory does not include null values, and for this reason the concept of functional dependency (and violation of FD) is not defined in presence of such values.

Note that NULL is not a constant, neither a different value each time it is used. This can be seen if you try something like:

SELECT NULL = NULL;

the result is neither TRUE (the two values are in effect the same value) nor FALSE (the two values are different), but NULL, which means that we have no information at all about the real values (even if they exist or not!). And this is the foundamental reason for which it has no sense to consider or not a violation of a FD in presence of a null value.

For instance, considering your question, let's think about the meaning of a functional dependency. Since from the dependencies that you have listed we can derive A -> D, this means that each time in a tuple there is a certain value of the attribute A, there should be the same value of the attribute D. But if we have two tuples with the same value of A, and one of them has a NULL value for D, while the other has a normal value, this means that we do not know if the dependency is violated or not, since we do not know nothing about the value of the attribute specified as NULL. It could be unknown, and be the same, or different, or it could not be present. So nothing can be said about the violation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.