D
D
dienerie2020-09-16 11:31:29
SQL
dienerie, 2020-09-16 11:31:29

What is the difference between IN and an equals sign?

Actually, the same question, gentlemen.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaly Voloboev, 2020-09-25
@dienerie

= is used for direct comparison with a single value,
works well with nested queries with an aggregate function, or an exact character-by-character value
IN is used if there are several comparison options, and any of the above is suitable, for example,
I need to select a sweater, where the color is IN ('blue', 'brown', 'green')
would be faster than writing
WHERE color = 'blue' OR color = 'brown' OR color = 'green'

S
Sergey delphinpro, 2020-09-16
@delphinpro

x = a
или
x IN [a, b, c]

In my opinion the difference is obvious.

L
Lazy @BojackHorseman, 2020-09-16
SQL

equality with one of the values ​​vs. equality with one value

S
Sergey, 2020-09-16
@Kianl

https://www.w3schools.com/sql/sql_in.asp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question