We can't compare NULL value with NULL value as the meaning of NULL value is absence of any value. Check this table ( table1)
id
first_name
last_name
2
Alex
John
3
Ron
Ron
4
NULL
NULL
SELECT * FROM table1 WHERE first_name=last_name
The output is here
id
first_name
last_name
3
Ron
Ron
Why the record with NULL value as first_name and last_name is not included in the output ?
This is because we can't compare NULL value with NULL value . Read this output
SELECT NULL=NULL
Output of above query is NULL. ( Why ? )
Let us try one more query
SELECT * FROM table1 WHERE first_name <=> last_name
The output is here
id
first_name
last_name
3
Ron
Ron
4
NULL
NULL
By using Null safe operator we can get two records including the row having NULL value in both the columns.
SQL with NULL Value →
Using STRCMP
We can compare strings by using string function STRCMP
SELECT STRCMP('plus2net','PLUS2NET')
As both strings are same, so we will get 0 as output.
STRCMP: String comparison →
SQL dump of plus2_boolean table