Trying to understand MySQL logic
| RecordDay | RecordMonth | RecordYear
----------------------------------------
02 | 04 | 2013
03 | 05 | 2014
04 | 06 | 2015
My logic. If I want to see all records except records where RecordDay = 02 and RecordMonth = 04 and RecordYear = 2013 (do not want to see records where date is 02.April, 2013), I write query like WHERE CAST(RecordDay AS UNSIGNED) != ? AND CAST(RecordMonth AS UNSIGNED) != ? AND CAST(RecordYear AS UNSIGNED) != ?. Like if I want to see, I write the same query with =. For = query works, but for != does not.
Now understand that with the query MySQL goes through columns and rows and excludes results where RecordDay = 02, RecordMonth = 04, RecordYear = 2013. With the query I as if tell I do not want to see results where...
See that this query WHERE (CAST(RecordDay AS UNSIGNED) != ? OR CAST(RecordMonth AS UNSIGNED) != ? OR CAST(RecordYear AS UNSIGNED) != ?) works. But do not understand why it works.
What does MySQL do? Goes through columns and rows, find row where RecordDay = 02, then check what values are in RecordMonth and RecordYear...
Found explanation
The AND operator displays a record if both the first condition AND the second condition are true. In the same way should be The AND operator **does not** display a record if both the first condition AND the second condition are true.
The OR operator displays a record if either the first condition OR the second condition is true.
And how with > REGEXP-contains?
Mess in my head....