ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajq_5.4.0.1/viewcomposite.htm

69 lines
4.1 KiB
HTML
Raw Permalink 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 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="reference" />
<meta name="DC.Title" content="View composite implementation" />
<meta name="abstract" content="The view composite implementation takes the query select statement and combines it with the select statement of the view to generate a new query. The new, combined select statement query is then run directly against the underlying base tables." />
<meta name="description" content="The view composite implementation takes the query select statement and combines it with the select statement of the view to generate a new query. The new, combined select statement query is then run directly against the underlying base tables." />
<meta name="DC.Relation" scheme="URI" content="viewopt.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="viewcomposite" />
<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>View composite implementation</title>
</head>
<body id="viewcomposite"><a name="viewcomposite"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">View composite implementation</h1>
<div><p>The view composite implementation takes the query select statement
and combines it with the select statement of the view to generate a new query.
The new, combined select statement query is then run directly against the
underlying base tables.</p>
<div class="section"><p>This single, composite statement is the preferred implementation
for queries containing views, since it requires only a single pass of the
data.</p>
<p>See the following examples:</p>
</div>
<div class="example"> <pre><strong>CREATE VIEW</strong> D21EMPL <strong>AS</strong>
<strong>SELECT</strong> * <strong>FROM</strong> CORPDATA.EMPLOYEE
<strong>WHERE</strong> WORKDEPT='D21'</pre>
</div>
<div class="section"><p>Using SQL: </p>
<pre> <strong>SELECT</strong> LASTNAME, FIRSTNME, SALARY
<strong>FROM</strong> D21EMPL
<strong>WHERE</strong> JOB='CLERK' </pre>
</div>
<div class="section"><p>The query optimizer will generate a new query that looks like
the following example: </p>
<pre><strong>SELECT</strong> LASTNAME, FIRSTNME, SALARY
<strong>FROM</strong> CORPDATA.EMPLOYEE
<strong>WHERE</strong> WORKDEPT='D21' <strong>AND</strong> JOB='CLERK' </pre>
<p>The query
contains the columns selected by the user's query, the base tables referenced
in the query, and the selection from both the view and the user's query.</p>
<div class="note"><span class="notetitle">Note:</span> The
new composite query that the query optimizer generates is not visible to users.
Only the original query against the view will be seen by users and database
performance tools.</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="viewopt.htm" title="Views, derived tables (nested table expressions or NTEs), and common table expressions (CTEs) are implemented by the query optimizer using one of two methods.">View implementation</a></div>
</div>
</div>
</body>
</html>