I encountered a piece of sql today that I can’t figure out, please help!
A mysql query statement:
select * from table where fielda='123' and not '456'
What does and not
mean?
I tried it myself select * from table where not '123'
can also be executed
How to understand?
What a strange way of writing.
Breakdown:
Equivalent to:
Equivalent to:
(I don’t know if my priorities are right)
MySQL syntax logical operators:
If the following operand is 0, the value is 1; if the operand is non-0, the value is 0, and NULL is treated specially, that is, NOT NULL is NULL.