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

41,726

Solution 1

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.

Solution 2

AND is Standard SQL

&& is proprietary syntax

Solution 3

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

Share:
41,726
Emanuil Rusev
Author by

Emanuil Rusev

Designer, developer, minimalist, maker of Nota, Historie, Parsedown.

Updated on November 02, 2022

Comments

  • Emanuil Rusev
    Emanuil Rusev over 1 year

    Is there a difference in the way SQL interprets the logical operators AND and &&?