Answer the question
In order to leave comments, you need to log in
Why is SQL query not capturing NULL rows?
Hello, I don't understand what is the problem. There is a small table in MySQL with countries. It has a currency_code field with currency codes.
I'm trying to get all countries whose currency is not Euro (code 978) using the following query:
But for some reason you don't get records with NULL, although it is logical that they are not equal to 978.
Why is this happening and how to overcome it?
Tried !=, still doesn't work.
Thank you! SELECT * FROM country WHERE currency_code <> 978
Answer the question
In order to leave comments, you need to log in
NULL in the muscle is not null, it is a separate data type not included in the comparative ranges and must be checked separately, that is, you need to addor currency_code IS NULL
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question