30 lines
482 B
Plaintext
30 lines
482 B
Plaintext
== Why is this an issue?
|
|
|
|
According to SQL-92:
|
|
|
|
____
|
|
"X BETWEEN Y AND Z" is equivalent to "X >= Y AND X +<=+ Z"
|
|
|
|
____
|
|
|
|
Even if the ``++BETWEEN++`` predicate is simply syntactic sugar, using it can improve the readability of a SQL WHERE clause, and is therefore preferred.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,text]
|
|
----
|
|
SELECT * FROM PERSONS
|
|
WHERE AGE >= 18 and AGE <= 60
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,text]
|
|
----
|
|
SELECT * FROM PERSONS
|
|
WHERE AGE BETWEEN 18 and 60
|
|
----
|
|
|