584. Find Customer Referee

https://leetcode.com/articles/find-customer-referee/

select name from customer

where referee_id <> 2 or referee_id  is null;

MySQL uses three-valued logic -- TRUE, FALSE and UNKNOWN. Anything compared to NULL evaluates to the third value: UNKNOWN. That “anything” includes NULL itself! That’s why MySQL provides the IS NULLand IS NOT NULL operators to specifically check for NULL.

猜你喜欢

转载自www.cnblogs.com/ffeng0312/p/9820363.html