mysql syntax where abbreviation?
迷茫
迷茫 2017-06-10 09:49:43
0
2
1056

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?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(2)
代言

What a strange way of writing.

fielda='123' and not '456'

Breakdown:

fielda='123'
and
not '456'

Equivalent to:

fielda='123' and 0

Equivalent to:

select * from table where 0

(I don’t know if my priorities are right)

  • reply and means that two conditions must be met
    梦想成真 author 2017-06-10 21:27:47
typecho

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template