Heim  >  Fragen und Antworten  >  Hauptteil

MySQL-Syntax wo Abkürzung?

Ich bin heute auf eine SQL-Anweisung gestoßen, die ich nicht verstehe. Bitte helfen Sie mir!

Eine MySQL-Abfrageanweisung:

select * from table where fielda='123' and not '456'
Was bedeutet

and not?

Ich habe es selbst ausprobiert select * from table where not '123' und es funktioniert

Wie ist das zu verstehen?

迷茫迷茫2687 Tage vor1020

Antworte allen(2)Ich werde antworten

  • 代言

    代言2017-06-10 09:51:43

    好奇怪的写法。

    fielda='123' and not '456'
    

    分解:

    fielda='123'
    and
    not '456'
    

    等价于:

    fielda='123' and 0
    

    等价于:

    select * from table where 0
    

    (不知道我的优先级对不对)

    Antwort
    0
  • 梦想成真

    and的意思是必须要满足两个条件

    梦想成真 · 2017-06-10 21:27:47
  • typecho

    typecho2017-06-10 09:51:43

    MySQL语法逻辑操作符:

    如果后面的操作数是是0,值为1;如果操作数非0,值为0,NULL特殊处理,即是 NOT NULL为NULL。

    Antwort
    0
  • StornierenAntwort