Is there a difference in the way SQL interprets the logical operators AND
and &&
?
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.
AND
is Standard SQL
&&
is proprietary syntax
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
来源:https://stackoverflow.com/questions/4105658/the-difference-between-and-and-in-sql