Difference between revisions of "SQL Logical operators"

From Recital Documentation Wiki
Jump to: navigation, search
(Products)
Line 65: Line 65:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL|Operators,Logical]]
 
[[Category:SQL|Operators,Logical]]

Revision as of 17:21, 8 December 2009

Purpose

Logical Operators


Syntax

<condition1> AND <condition2> NOT <condition> <condition1> OR <condition2> <condition1> XOR <condition2>


See Also

INSERT, SQL OPERATORS, SELECT, UPDATE


Description

Operator Description
AND True if <condition1> and <condition2> conditions are both true, otherwise False
NOT True if the <condition> is false, otherwise False
OR True if <condition1> or <condition2> is true or if both conditions are true, otherwise False
XOR True if <condition1> or <condition2> is true but not both, otherwise False


Example

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


Products

Recital, Recital Server