ibm-information-center/dist/eclipse/plugins/i5OS.ic.db2_5.4.0.1/rbafzmstch2srch.htm

148 lines
7.6 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="dc.language" scheme="rfc1766" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<meta name="dc.date" scheme="iso8601" content="2005-09-19" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow"/>
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="keywords" content="logical operator, truth valued logic, description,
search condition, truth table, AND, OR, order of evaluation" />
<title>Search conditions</title>
<link rel="stylesheet" type="text/css" href="ibmidwb.css" />
<link rel="stylesheet" type="text/css" href="ic.css" />
</head>
<body>
<a id="Top_Of_Page" name="Top_Of_Page"></a><!-- Java sync-link -->
<script language = "Javascript" src = "../rzahg/synch.js" type="text/javascript"></script>
<a name="ch2srch"></a>
<h2 id="ch2srch"><a href="rbafzmst02.htm#ToC_311">Search conditions</a></h2>
<a href="rbafzmstch2srch.htm#synsearchcon"><img src="c.gif" alt="Click to skip syntax diagram" /></a>
<a name="wq443"></a>
<div class="fignone" id="wq443">
<pre class="cgraphic"><span><img src="c.gif" alt="Read syntax diagram" longdesc="rbafzmstsyn37.htm"
border="0" /></span><a href="#skipsyn-36"><img src="c.gif" alt="Skip visual syntax diagram"
border="0" /></a>>>-+-----+--+-<span class="italic">predicate</span>----------+------------------------------>
'-NOT-' '-<span class="italic">(search-condition)</span>-'
.----------------------------------------------.
V |
>----+------------------------------------------+-+------------>&lt;
'-+-AND-+--+-----+--+-<span class="italic">predicate</span>----------+-'
'-OR--' '-NOT-' '-<span class="italic">(search-condition)</span>-'
</pre>
<a name="skipsyn-36" id="skipsyn-36"></a></div>
<a name="synsearchcon"></a>
<p id="synsearchcon">A <span class="italic">search condition</span> specifies
a condition that is true, false, or unknown about a given row or group.</p><a id="idx779" name="idx779"></a><a id="idx780" name="idx780"></a><a id="idx781" name="idx781"></a>
<p>The result of a search condition is derived by application of the specified <span class="italic">logical operators</span> (AND, OR, NOT) to the result of each
specified predicate. If logical operators are not specified, the result of
the search condition is the result of the specified predicate.</p><a id="idx782" name="idx782"></a><a id="idx783" name="idx783"></a><a id="idx784" name="idx784"></a>
<p>AND and OR are defined in the following table in which P and Q are any
predicates:</p>
<a name="truth1"></a>
<table id="truth1" width="100%" summary="" border="1" frame="hsides" rules="all">
<caption>Table 27. Truth Tables for AND and OR</caption>
<thead valign="bottom">
<tr>
<th id="wq444" width="25%" align="left" valign="bottom">P</th>
<th id="wq445" width="25%" align="left" valign="bottom">Q</th>
<th id="wq446" width="25%" align="left" valign="bottom">P AND Q</th>
<th id="wq447" width="25%" align="left" valign="bottom">P OR Q</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td align="left" valign="top" headers="wq444">
<a id="booly" name="booly"></a>True</td>
<td align="left" valign="top" headers="wq445">True</td>
<td align="left" valign="top" headers="wq446">True</td>
<td align="left" valign="top" headers="wq447">True</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq444">True</td>
<td align="left" valign="top" headers="wq445">False</td>
<td align="left" valign="top" headers="wq446">False</td>
<td align="left" valign="top" headers="wq447">True</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq444">True</td>
<td align="left" valign="top" headers="wq445">Unknown</td>
<td align="left" valign="top" headers="wq446">Unknown</td>
<td align="left" valign="top" headers="wq447">True</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq444">False</td>
<td align="left" valign="top" headers="wq445">True</td>
<td align="left" valign="top" headers="wq446">False</td>
<td align="left" valign="top" headers="wq447">True</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq444">False</td>
<td align="left" valign="top" headers="wq445">False</td>
<td align="left" valign="top" headers="wq446">False</td>
<td align="left" valign="top" headers="wq447">False</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq444">False</td>
<td align="left" valign="top" headers="wq445">Unknown</td>
<td align="left" valign="top" headers="wq446">False</td>
<td align="left" valign="top" headers="wq447">Unknown</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq444">Unknown</td>
<td align="left" valign="top" headers="wq445">True</td>
<td align="left" valign="top" headers="wq446">Unknown</td>
<td align="left" valign="top" headers="wq447">True</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq444">Unknown</td>
<td align="left" valign="top" headers="wq445">False</td>
<td align="left" valign="top" headers="wq446">False</td>
<td align="left" valign="top" headers="wq447">Unknown</td>
</tr>
<tr>
<td align="left" valign="top" headers="wq444">Unknown</td>
<td align="left" valign="top" headers="wq445">Unknown</td>
<td align="left" valign="top" headers="wq446">Unknown</td>
<td align="left" valign="top" headers="wq447">Unknown</td>
</tr>
</tbody>
</table>
<p>NOT(true) is false, NOT(false) is true, and NOT(unknown) is unknown.</p><a id="idx785" name="idx785"></a>
<p>Search conditions within parentheses are evaluated first. If the order
of evaluation is not specified by parentheses, NOT is applied before AND,
and AND is applied before OR. The order in which operators at the same precedence
level are evaluated is undefined to allow for optimization of search conditions.</p>
<a name="wq448"></a>
<h3 id="wq448"><a href="rbafzmst02.htm#ToC_312">Examples</a></h3>
<p>In the examples, the numbers on the second line indicate the order in which
the operators are evaluated.</p>
<a name="wq449"></a>
<h4 id="wq449">Example 1</h4>
<pre class="xmp"> MAJPROJ = 'MA2100' <span class="bold">AND</span> DEPTNO = 'D11' <span class="bold">OR</span> DEPTNO = 'B03' <span class="bold">OR</span> DEPTNO = 'E11'
<span class="bold">1 2 or 3 2 or 3</span> </pre>
<a name="wq450"></a>
<h4 id="wq450">Example 2</h4>
<pre class="xmp">MAJPROJ = 'MA2100' <span class="bold">AND</span> (DEPTNO = 'D11' <span class="bold">OR</span> DEPTNO = 'B03') <span class="bold">OR</span> DEPTNO = 'E11'
<span class="bold">2 1 3</span></pre>
<pre class="xmp"></pre>
<hr /><br />
[ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstch2pred.htm">Previous Page</a> | <a href="rbafzmstch2func.htm">Next Page</a> | <a href="rbafzmst02.htm#wq1">Contents</a> |
<a href="rbafzmstindex.htm#index">Index</a> ]
<a id="Bot_Of_Page" name="Bot_Of_Page"></a>
</body>
</html>