开发者

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

Is there a difference in the开发者_如何学Go way SQL interprets the logical operators AND 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.


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜