简体   繁体   中英

The difference between 'AND' and '&&' in SQL

SQL解释逻辑运算符AND&&的方式有区别吗?

AND is Standard SQL

&& is proprietary syntax

For mySQL: The manual is not saying it explicitly, but they are listed as identical:

AND, &&

Logical AND. Evaluates to 1 if all operands are nonzero and not NULL, to 0 if one or more operands are 0, otherwise NULL is returned.

The operator precedence page also makes no distiction.

According to this page http://msdn.microsoft.com/en-us/library/bb387129.aspx they have the same functionality in SQL Server.

MySql has this to say on the subject http://dev.mysql.com/doc/refman/5.0/en/logical-operators.html

If you're working with PostgreSQL, '&&' means overlap (have elements in common):

example: ARRAY[1,4,3] && ARRAY[2,1]

https://www.postgresql.org/docs/9.1/static/functions-array.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM