1
0
forked from docs/doc-exports
doc-exports/docs/dws/dev/dws_06_0028.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

97 lines
8.8 KiB
HTML

<a name="EN-US_TOPIC_0000001188588998"></a><a name="EN-US_TOPIC_0000001188588998"></a>
<h1 class="topictitle1">Logical Operators</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001188588998__ade7d2cb6d116411bbd1362109e067a34">The usual logical operators include AND, OR, and NOT. SQL uses a three-valued logical system with true, false, and null, which represents "unknown". Their priorities are NOT &gt; AND &gt; OR.</p>
<p id="EN-US_TOPIC_0000001188588998__a7f754eee726d48e8971d8f69aa2fd620"><a href="#EN-US_TOPIC_0000001188588998__tbaf36a0380cb4d0cbf0bbc6bef0d21d1">Table 1</a> lists operation rules, where a and b represent logical expressions.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001188588998__tbaf36a0380cb4d0cbf0bbc6bef0d21d1"></a><a name="tbaf36a0380cb4d0cbf0bbc6bef0d21d1"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001188588998__tbaf36a0380cb4d0cbf0bbc6bef0d21d1" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Operation rules</caption><thead align="left"><tr id="EN-US_TOPIC_0000001188588998__r59c2035a20e148e1acf273c02db62a52"><th align="left" class="cellrowborder" valign="top" width="17.858214178582145%" id="mcps1.3.3.2.6.1.1"><p id="EN-US_TOPIC_0000001188588998__a43081eb9457f49598e88c6f60ae98baf">a</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.91830816918308%" id="mcps1.3.3.2.6.1.2"><p id="EN-US_TOPIC_0000001188588998__a23ac5958dd7c4445bf66265bb2a8afe3">b</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="22.187781221877813%" id="mcps1.3.3.2.6.1.3"><p id="EN-US_TOPIC_0000001188588998__a9de071a234e8407090d6510c60856821">a <strong id="EN-US_TOPIC_0000001188588998__b28106029">AND</strong> b Result</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="24.047595240475953%" id="mcps1.3.3.2.6.1.4"><p id="EN-US_TOPIC_0000001188588998__a575d5ab5e34c43a6846b5b2775c641b5">a<em id="EN-US_TOPIC_0000001188588998__i26791430"> </em><strong id="EN-US_TOPIC_0000001188588998__b51228171">OR</strong><strong id="EN-US_TOPIC_0000001188588998__b10345062"> </strong>b Result</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18.988101189881014%" id="mcps1.3.3.2.6.1.5"><p id="EN-US_TOPIC_0000001188588998__a7d945467b1a6407db4a97800b6007e72"><strong id="EN-US_TOPIC_0000001188588998__b16884906162743">NOT</strong> a Result</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001188588998__recec40d823b7477cb75d90044d4a45ec"><td class="cellrowborder" valign="top" width="17.858214178582145%" headers="mcps1.3.3.2.6.1.1 "><p id="EN-US_TOPIC_0000001188588998__afc68d8445a024670a7d019ad52a1828e">TRUE</p>
</td>
<td class="cellrowborder" valign="top" width="16.91830816918308%" headers="mcps1.3.3.2.6.1.2 "><p id="EN-US_TOPIC_0000001188588998__ad6ff87c360d54ac88682669819273d15">TRUE</p>
</td>
<td class="cellrowborder" valign="top" width="22.187781221877813%" headers="mcps1.3.3.2.6.1.3 "><p id="EN-US_TOPIC_0000001188588998__a7e8757841c0644e98190ff760303f22d">TRUE</p>
</td>
<td class="cellrowborder" valign="top" width="24.047595240475953%" headers="mcps1.3.3.2.6.1.4 "><p id="EN-US_TOPIC_0000001188588998__a9514b24b43034acd81d8e43457af03e7">TRUE</p>
</td>
<td class="cellrowborder" valign="top" width="18.988101189881014%" headers="mcps1.3.3.2.6.1.5 "><p id="EN-US_TOPIC_0000001188588998__ac286b65453fa4ab9815a19784aca1664">FALSE</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188588998__r0c3e589effa1448d9773bd29b3d60824"><td class="cellrowborder" valign="top" width="17.858214178582145%" headers="mcps1.3.3.2.6.1.1 "><p id="EN-US_TOPIC_0000001188588998__ae8f682c94596472e8f57e20ced777e65">TRUE</p>
</td>
<td class="cellrowborder" valign="top" width="16.91830816918308%" headers="mcps1.3.3.2.6.1.2 "><p id="EN-US_TOPIC_0000001188588998__ab53a598049134eeda2967ac04f5104bb">FALSE</p>
</td>
<td class="cellrowborder" valign="top" width="22.187781221877813%" headers="mcps1.3.3.2.6.1.3 "><p id="EN-US_TOPIC_0000001188588998__acc4bcb7e083049efac9c72fd1257a19a">FALSE</p>
</td>
<td class="cellrowborder" valign="top" width="24.047595240475953%" headers="mcps1.3.3.2.6.1.4 "><p id="EN-US_TOPIC_0000001188588998__a6a213cde828040ee88e6e8bfa4ea2d19">TRUE</p>
</td>
<td class="cellrowborder" valign="top" width="18.988101189881014%" headers="mcps1.3.3.2.6.1.5 "><p id="EN-US_TOPIC_0000001188588998__aa4716c7e74524c16833492dc4428df7b">FALSE</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188588998__r42f7d90680ef44b38fbbe413a60c7515"><td class="cellrowborder" valign="top" width="17.858214178582145%" headers="mcps1.3.3.2.6.1.1 "><p id="EN-US_TOPIC_0000001188588998__a5b079456a5ac45dda3a31810eb6cc26f">TRUE</p>
</td>
<td class="cellrowborder" valign="top" width="16.91830816918308%" headers="mcps1.3.3.2.6.1.2 "><p id="EN-US_TOPIC_0000001188588998__ab45ae6d6259347b68869fe2127b0e5ff">NULL</p>
</td>
<td class="cellrowborder" valign="top" width="22.187781221877813%" headers="mcps1.3.3.2.6.1.3 "><p id="EN-US_TOPIC_0000001188588998__ae6205bb890d4459a95523afd36307e0d">NULL</p>
</td>
<td class="cellrowborder" valign="top" width="24.047595240475953%" headers="mcps1.3.3.2.6.1.4 "><p id="EN-US_TOPIC_0000001188588998__a1f44455ca1094542aab5adefb21c4fea">TRUE</p>
</td>
<td class="cellrowborder" valign="top" width="18.988101189881014%" headers="mcps1.3.3.2.6.1.5 "><p id="EN-US_TOPIC_0000001188588998__aae50719eb0804106a086d3a0ea9ae2ef">FALSE</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188588998__rdcf232fef5484a8b9eb9da7a1b77658e"><td class="cellrowborder" valign="top" width="17.858214178582145%" headers="mcps1.3.3.2.6.1.1 "><p id="EN-US_TOPIC_0000001188588998__a12e92fd7def247a0a401888f81b7aafd">FALSE</p>
</td>
<td class="cellrowborder" valign="top" width="16.91830816918308%" headers="mcps1.3.3.2.6.1.2 "><p id="EN-US_TOPIC_0000001188588998__a7ada08cc24e14c25af69eeb60a094300">FALSE</p>
</td>
<td class="cellrowborder" valign="top" width="22.187781221877813%" headers="mcps1.3.3.2.6.1.3 "><p id="EN-US_TOPIC_0000001188588998__ae79cf89e73f74e64876aee430a9cb148">FALSE</p>
</td>
<td class="cellrowborder" valign="top" width="24.047595240475953%" headers="mcps1.3.3.2.6.1.4 "><p id="EN-US_TOPIC_0000001188588998__ab4cd41e1a68f4964acbe1155f11fa1a0">FALSE</p>
</td>
<td class="cellrowborder" valign="top" width="18.988101189881014%" headers="mcps1.3.3.2.6.1.5 "><p id="EN-US_TOPIC_0000001188588998__a8935f3810d2e4dfcb749bec849499f8c">TRUE</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188588998__r63be6a8733a94955ab6dab3475a5b244"><td class="cellrowborder" valign="top" width="17.858214178582145%" headers="mcps1.3.3.2.6.1.1 "><p id="EN-US_TOPIC_0000001188588998__a04a8df3c95c24a56a9c63782f60604e7">FALSE</p>
</td>
<td class="cellrowborder" valign="top" width="16.91830816918308%" headers="mcps1.3.3.2.6.1.2 "><p id="EN-US_TOPIC_0000001188588998__aea23711c7a7d4548b04d2a41f07a1e5c">NULL</p>
</td>
<td class="cellrowborder" valign="top" width="22.187781221877813%" headers="mcps1.3.3.2.6.1.3 "><p id="EN-US_TOPIC_0000001188588998__ac3d3d2dac0a64f9ea6eb8b57491ee053">FALSE</p>
</td>
<td class="cellrowborder" valign="top" width="24.047595240475953%" headers="mcps1.3.3.2.6.1.4 "><p id="EN-US_TOPIC_0000001188588998__ad524be4750a94d559ebf24fc556dd37d">NULL</p>
</td>
<td class="cellrowborder" valign="top" width="18.988101189881014%" headers="mcps1.3.3.2.6.1.5 "><p id="EN-US_TOPIC_0000001188588998__a716f2fff5db14be9bd16f16ad472752b">TRUE</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001188588998__rd3297bca4064450b8bebb0eb2477ab08"><td class="cellrowborder" valign="top" width="17.858214178582145%" headers="mcps1.3.3.2.6.1.1 "><p id="EN-US_TOPIC_0000001188588998__a666b2a24e10b41558d154a18142a97ad">NULL</p>
</td>
<td class="cellrowborder" valign="top" width="16.91830816918308%" headers="mcps1.3.3.2.6.1.2 "><p id="EN-US_TOPIC_0000001188588998__ac9aeb6b4cd5949cc9664c61ae152fb91">NULL</p>
</td>
<td class="cellrowborder" valign="top" width="22.187781221877813%" headers="mcps1.3.3.2.6.1.3 "><p id="EN-US_TOPIC_0000001188588998__a6303efb9903b45aca56157b40f83a052">NULL</p>
</td>
<td class="cellrowborder" valign="top" width="24.047595240475953%" headers="mcps1.3.3.2.6.1.4 "><p id="EN-US_TOPIC_0000001188588998__a77ce08879ceb4f54aae21fce17d8f753">NULL</p>
</td>
<td class="cellrowborder" valign="top" width="18.988101189881014%" headers="mcps1.3.3.2.6.1.5 "><p id="EN-US_TOPIC_0000001188588998__a8ec66f9f1b3c41dd95bd6355b60a3b26">NULL</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="note" id="EN-US_TOPIC_0000001188588998__n288e795cd6b44b288e74ed0e27774c34"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001188588998__aa4a7bf1318a945fa9797e0dce01b5e29">The operators AND and OR are commutative, that is, you can switch the left and right operand without affecting the result.</p>
</div></div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0027.html">Functions and Operators</a></div>
</div>
</div>