SQL BETWEEN

SQL- ?

     SELECT * FROM Products
     WHERE Price BETWEEN 10 AND 20;

, ?

     SELECT * FROM Products
     WHERE Price BETWEEN 20 AND 10;
+4
4
 SELECT * FROM Products
 WHERE Price BETWEEN 20 AND 10;

 SELECT * FROM Products
 WHERE Price >= 20 AND Price <= 10;
+3

BETWEEN TRUE, test_expression begin_expression end_expression. NOT BETWEEN TRUE, test_expression begin_expression end_expression.

greater than or equal to 20 AND less than or equal to 10

+3

. :

x BETWEEN a AND b

a <= x AND x <= b

a > b, .

, BETWEEN, , , a <= b.

0

MSDN T-SQL BETWEEN :

test_expression [ NOT ] BETWEEN begin_expression AND end_expression

[...] BETWEEN TRUE, test_expression begin_expression end_expression.

, , : no Price ≥ 20 ≤ 10, , . ( , , Price ≥ 10, ≤ 20, .)

0

Source: https://habr.com/ru/post/1537661/


All Articles