ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafysubquery.htm

66 lines
4.2 KiB
HTML

<?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 lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<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="DC.Type" content="concept" />
<meta name="DC.Title" content="Use subqueries" />
<meta name="abstract" content="You can use subqueries in a search condition as another way to select your data. Subqueries can be used anywhere an expression can be used." />
<meta name="description" content="You can use subqueries in a search condition as another way to select your data. Subqueries can be used anywhere an expression can be used." />
<meta name="DC.subject" content="subquery" />
<meta name="keywords" content="subquery" />
<meta name="DC.Relation" scheme="URI" content="rbafydml.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafysubq.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafycorrs.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafywhereexp.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafycomsrch.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rbafysubquery" />
<meta name="DC.Language" 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. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Use subqueries</title>
</head>
<body id="rbafysubquery"><a name="rbafysubquery"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use subqueries</h1>
<div><p>You can use subqueries in a search condition as another
way to select your data. Subqueries can be used anywhere an expression can
be used.</p>
<p>Conceptually, a subquery is evaluated whenever a new row or group of rows
must be processed. In fact, if the subquery is the same for every row or group,
it is evaluated only once. Subqueries like this are said to be <strong>uncorrelated</strong>.</p>
<p>Some subqueries return different values from row to row or group to group.
The mechanism that allows this is called <strong>correlation</strong>, and the subqueries
are said to be <strong>correlated</strong>.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbafysubq.htm">Subqueries in SELECT statements</a></strong><br />
Subqueries can help you to further refine your search conditions.</li>
<li class="ulchildlink"><strong><a href="rbafycorrs.htm">Correlated subqueries</a></strong><br />
You can write a subquery that SQL might need to re-evaluate as
it examines each new row (WHERE clause) or group of rows (HAVING clause) in
the outer-level SELECT. This is called a <dfn class="term">correlated subquery</dfn>.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafydml.htm" title="Data manipulation language (DML) describes the portion of SQL that allows you to manipulate or control your data.">Data manipulation language</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rbafywhereexp.htm" title="An expression in a WHERE clause names or specifies something you want to compare to something else.">Expressions in the WHERE clause</a></div>
<div><a href="rbafycomsrch.htm" title="In addition to the basic comparison predicates (=, &gt;, &lt;, and so on), a search condition can contain any of the predicates BETWEEN, IN, EXISTS, IS NULL, and LIKE.">Define complex search conditions</a></div>
</div>
</div>
</body>
</html>