<?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="CREATE VIEW statement, system column name" /> <title>Views</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="viewdef"></a> <h2 id="viewdef"><a href="rbafzmst02.htm#ToC_35">Views</a></h2><a id="idx102" name="idx102"></a> <p>A <span class="italic">view</span> provides an alternative way of looking at the data in one or more tables.</p> <p>A view is a named specification of a result table. The specification is a SELECT statement that is effectively executed whenever the view is referenced in an SQL statement. Thus, a view can be thought of as having columns and rows just like a base table. For retrieval, all views can be used just like base tables. Whether a view can be used in an insert, update, or delete operation depends on its definition.</p> <p>An index cannot be created for a view. However, an index created for a table on which a view is based may improve the performance of operations on the view.</p> <p>When the column of a view is directly derived from a column of a base table, that column inherits any constraints that apply to the column of the base table. For example, if a view includes a foreign key of its base table, INSERT and UPDATE operations using that view are subject to the same referential constraints as the base table. Likewise, if the base table of a view is a parent table, DELETE operations using that view are subject to the same rules as DELETE operations on the base table. A view also inherits any triggers that apply to its base table. For example, if the base table of a view has an update trigger, the trigger is fired when an update is performed on the view.</p> <p>A view has a name and may have a different system name. The system name is the name used by i5/OS. Either name is acceptable wherever a <span class="italic">view-name</span> is specified in SQL statements.</p><a id="idx103" name="idx103"></a> <p>A column of a view has a name and may have a different system column name. The system column name is the name used by i5/OS. Either name is acceptable wherever <span class="italic">column-name</span> is specified in SQL statements.</p> <p>A <span class="italic">view</span> is created with the CREATE VIEW statement. For more information about creating views, see <a href="rbafzmsthcview.htm#hcview">CREATE VIEW</a>.</p> <hr /><br /> [ <a href="#Top_Of_Page">Top of Page</a> | <a href="rbafzmstch1table.htm">Previous Page</a> | <a href="rbafzmstudtdef.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>