Examveda

What will be the output of the following MySQL statement "true AND Null"?

A. True

B. Null

C. Depend

D. None of the mentioned

Answer: Option B

Solution (By Examveda Team)

This question is about how MySQL handles Boolean logic and NULL values.
In MySQL, NULL represents a missing or unknown value.
When you use the AND operator with TRUE and NULL, the result will be NULL.
Here's why:
- TRUE means the condition is met.
- NULL means the condition is unknown or missing.
- AND operator requires both conditions to be true for the result to be true. Since NULL is unknown, the entire statement is considered unknown and evaluates to NULL.
So the correct answer is Option B: Null.
In simpler terms, if you have a statement like "It's sunny today AND I have an umbrella", but you don't know if you have an umbrella, the entire statement is considered uncertain, just like NULL.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous