Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 253
Emanuil Rusev Avatar asked Nov 05 '10 12:11

Emanuil Rusev


People also ask

What is the difference between and and and?

"&" is used only when it is used between two nouns. for example: Rita & Gita went out to play. "and" is used when you want to join two sentences.

WHAT IS and and OR in grammar?

And/or (sometimes written and or) is an English grammatical conjunction used to indicate that one or more (or even all) of the cases it connects may occur. It is used as an inclusive or (as in logic and mathematics), because saying "or" in spoken language (or writing "or") might be inclusive or exclusive.

What is the difference between and and ampersand?

What is an ampersand? An ampersand (&) is a typographical symbol that is rarely used in formal writing. It is read aloud as the word and and is used as a substitute for that word in informal writing and in the names of products or businesses.

What is the difference between (;) and (:)?

Colons and semicolons are two types of punctuation. Colons (:) are used in sentences to show that something is following, like a quotation, example, or list. Semicolons (;) are used to join two independent clauses, or two complete thoughts that could stand alone as complete sentences.


2 Answers

AND is Standard SQL

&& is proprietary syntax

like image 59
onedaywhen Avatar answered Sep 23 '22 14:09

onedaywhen


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.

like image 43
Pekka Avatar answered Sep 23 '22 14:09

Pekka