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

123 lines
9.9 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 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="Retrieve data using the SELECT statement" />
<meta name="abstract" content="Learn a variety of ways of tailoring your query to gather data using the SELECT statement. One way to do this is to use the SELECT statement in a program to retrieve a specific row (for example, the row for an employee). Furthermore, you can use clauses to gather data in a specific way." />
<meta name="description" content="Learn a variety of ways of tailoring your query to gather data using the SELECT statement. One way to do this is to use the SELECT statement in a program to retrieve a specific row (for example, the row for an employee). Furthermore, you can use clauses to gather data in a specific way." />
<meta name="DC.subject" content="SELECT statement, data manipulation statement (DML)" />
<meta name="keywords" content="SELECT statement, data manipulation statement (DML)" />
<meta name="DC.Relation" scheme="URI" content="rbafydml.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyselectbasic.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafywhere.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafygroup.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyhaving.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyorderby.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafycolum.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafynulls.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyspecreg.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafycasting.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafydtts.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafydupl.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafycomsrch.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyolap.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyjoin.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafytabexp.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyrecursivequeries.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafykeyu.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyexcept.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyintersect.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyretrievalerrors.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafycrttblas.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyviewnt.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="rbafytexas" />
<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>Retrieve data using the SELECT statement</title>
</head>
<body id="rbafytexas"><a name="rbafytexas"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Retrieve data using the SELECT statement</h1>
<div><p><span>Learn a variety of ways of tailoring
your query to gather data using the SELECT statement. One way to do this is
to use the SELECT statement in a program to retrieve a specific row (for example,
the row for an employee). Furthermore, you can use clauses to gather data
in a specific way. </span></p>
<p>If SQL is unable to find a row that satisfies the search condition, an
SQLCODE of +100 is returned.</p>
<p>If SQL finds errors while running your select-statement, a negative SQLCODE
is returned. If SQL finds more host variables than results, +326 is returned.</p>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbafyselectbasic.htm">Basic SELECT statement</a></strong><br />
The format and syntax shown here are very basic. SELECT statements can be more varied than the examples presented in this topic.</li>
<li class="ulchildlink"><strong><a href="rbafywhere.htm">Specify a search condition using the WHERE clause</a></strong><br />
The WHERE clause specifies a search condition that identifies the row or rows you want to retrieve, update, or delete.</li>
<li class="ulchildlink"><strong><a href="rbafygroup.htm">GROUP BY clause</a></strong><br />
The GROUP BY clause allows you to find the characteristics of groups of rows rather than individual rows.</li>
<li class="ulchildlink"><strong><a href="rbafyhaving.htm">HAVING clause</a></strong><br />
The HAVING clause specifies a search condition for the groups selected by GROUP BY clause.</li>
<li class="ulchildlink"><strong><a href="rbafyorderby.htm">ORDER BY clause</a></strong><br />
The ORDER BY clause specifies the particular order in which you want selected rows returned. The order is sorted by ascending or descending collating sequence of a column's or expression's value.</li>
<li class="ulchildlink"><strong><a href="rbafycolum.htm">Static SELECT statements</a></strong><br />
For a static SELECT statement (one embedded in an SQL program), an INTO clause must be specified before the FROM clause.</li>
<li class="ulchildlink"><strong><a href="rbafynulls.htm">Handle null values</a></strong><br />
A <em>NULL</em> value indicates the absence of a column value in
a row.</li>
<li class="ulchildlink"><strong><a href="rbafyspecreg.htm">Special registers in SQL statements</a></strong><br />
You can specify certain special registers in SQL statements.</li>
<li class="ulchildlink"><strong><a href="rbafycasting.htm">Cast data types</a></strong><br />
Sometimes you will find situations where the <em>type</em> of an
expression needs to be cast, or changed, to a different data type or to the
same data type with a different length, precision, or scale.</li>
<li class="ulchildlink"><strong><a href="rbafydtts.htm">Date, time, and timestamp data types</a></strong><br />
Date, time, and timestamp are data types represented in an internal form not seen by the SQL user.</li>
<li class="ulchildlink"><strong><a href="rbafydupl.htm">Handle duplicate rows</a></strong><br />
When SQL evaluates a select-statement, several rows might qualify to be in the result table, depending on the number of rows that satisfy the select-statement's search condition. Some of the rows in the result table might be duplicates.</li>
<li class="ulchildlink"><strong><a href="rbafycomsrch.htm">Define complex search conditions</a></strong><br />
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.</li>
<li class="ulchildlink"><strong><a href="rbafyolap.htm">Use OLAP specifications</a></strong><br />
<span>Online analytical processing (OLAP) specifications
are used to return ranking numbers and row numbers for the result rows of
a query. You can specify RANK, DENSE_RANK, and ROW_NUMBER.</span></li>
<li class="ulchildlink"><strong><a href="rbafyjoin.htm">Join data from more than one table</a></strong><br />
Sometimes the information you want to see is not in a single table. To form a row of the result table, you might want to retrieve some column values from one table and some column values from another table. You can retrieve and join column values from two or more tables into a single row.</li>
<li class="ulchildlink"><strong><a href="rbafytabexp.htm">Use table expressions</a></strong><br />
You can use table expressions to specify an intermediate result table.</li>
<li class="ulchildlink"><strong><a href="rbafyrecursivequeries.htm">Use recursive queries</a></strong><br />
This topic introduces the use of recursive common table expressions and recursive views.</li>
<li class="ulchildlink"><strong><a href="rbafykeyu.htm">Use UNION keyword to combine subselects</a></strong><br />
Using the UNION keyword, you can combine two or more subselects to form a fullselect.</li>
<li class="ulchildlink"><strong><a href="rbafyexcept.htm">Use EXCEPT keyword</a></strong><br />
The EXCEPT keyword returns the result set of the first subselect minus any matching rows from the second subselect.</li>
<li class="ulchildlink"><strong><a href="rbafyintersect.htm">Use INTERSECT keyword</a></strong><br />
The INTERSECT keyword returns a combined result set that consists of all of the rows existing in both result sets.</li>
<li class="ulchildlink"><strong><a href="rbafyretrievalerrors.htm">Data retrieval errors</a></strong><br />
Sometimes when you issue a statement, it encounters an error.</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="rbafycrttblas.htm" title="The CREATE TABLE AS statement creates a table from the result of a SELECT statement.">Create a table using AS</a></div>
<div><a href="rbafyviewnt.htm" title="A view can be used to access data in one or more tables or views. You create a view by using a SELECT statement.">Create and use views</a></div>
</div>
</div>
</body>
</html>