Difference between revisions of "BETWEEN Predicate"

From Lianjapedia
Jump to: navigation, search
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Special predicate
 
Special predicate
 
  
 
==Syntax==
 
==Syntax==
 
<expression1> [NOT] BETWEEN <expression2> AND <expression3>
 
<expression1> [NOT] BETWEEN <expression2> AND <expression3>
 
  
 
==See Also==
 
==See Also==
 
[[SQL INSERT|INSERT]], [[SQL Predicates|PREDICATES]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
 
[[SQL INSERT|INSERT]], [[SQL Predicates|PREDICATES]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
 
  
 
==Description==
 
==Description==
Line 15: Line 12:
  
 
The optional NOT evaluates whether <expression1> is not greater than or equal to <expression2> and not less than or equal to <expression3>.
 
The optional NOT evaluates whether <expression1> is not greater than or equal to <expression2> and not less than or equal to <expression3>.
 
  
 
==Example==
 
==Example==
Line 25: Line 21:
 
</code>
 
</code>
  
 
==Products==
 
Recital, Recital Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL]]
 
[[Category:SQL]]

Latest revision as of 11:29, 26 October 2011

Purpose

Special predicate

Syntax

<expression1> [NOT] BETWEEN <expression2> AND <expression3>

See Also

INSERT, PREDICATES, SELECT, UPDATE

Description

BETWEEN is a special predicate to evaluate whether the specified <expression1> is greater than or equal to <expression2> and less than or equal to <expression3>. The data type must be the same for <expression1>, <expression2> and <expression3>.

The optional NOT evaluates whether <expression1> is not greater than or equal to <expression2> and not less than or equal to <expression3>.

Example

SELECT name, address, balance, cost*1.15;
  FROM accounts;
  WHERE paid_date < date() AND ord_value NOT BETWEEN 0 AND 10000;
  ORDER BY name, paid_date