Difference between revisions of "BETWEEN Predicate"

From Recital Documentation Wiki
Jump to: navigation, search
(Products)
 
(One intermediate revision by one user not shown)
Line 8: Line 8:
  
 
==See Also==
 
==See Also==
[[SQL Predicates|PREDICATES]], [[SQL INSERT|INSERT]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
+
[[SQL INSERT|INSERT]], [[SQL Predicates|PREDICATES]], [[SQL SELECT|SELECT]], [[SQL UPDATE|UPDATE]]
  
  
Line 19: Line 19:
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
EXEC SQL
+
SELECT name, address, balance, cost*1.15;
SELECT name, address, balance, cost*1.15
+
  FROM accounts;
FROM accounts
+
  WHERE paid_date < date() AND ord_value NOT BETWEEN 0 AND 10000;
WHERE paid_date < date() AND ord_value NOT BETWEEN 0 AND 10000
+
  ORDER BY name, paid_date
ORDER BY name, paid_date;
+
 
</code>
 
</code>
  

Latest revision as of 17:19, 22 December 2009

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


Products

Recital, Recital Server