The following chapters contain examples on embedding SQL statements in a host program. The following table lists the chapters in this part and what each contains:
|
Chapter/Section |
Contains |
|---|---|
|
Examples on different ways to use the select-statement to retrieve the desired data. |
|
|
An example on selecting all columns in a table. |
|
|
An example on selecting specific columns in a table. |
|
|
An example on using search conditions to limit the rows in the result table. |
|
|
An example on ordering returned data by values in the column(s). |
|
|
An example on eliminating duplicate rows in the returned data. |
|
|
Counting |
An example on counting the rows in a result table. |
|
Examples on using column values to calculate values which are not contained in the table, and also using a subquery (nested subselects). |
|
|
An example on grouping columns by value. |
|
|
An example on testing for existence of certain rows. |
|
|
Discusses the join and union operations on data from multiple tables. |
|
|
An example on deriving a result table which includes all specified data from two or more tables. |
|
|
An example on deriving a result table which is a set formed by the union of two result tables. |
|
|
Examples on using the INSERT statement to insert rows into a table. |
|
|
An example on using the UPDATE statement to update rows in a table. |
|
|
An example on using the DELETE statement to delete rows from a table. |
|
|
An example on using the COMMIT WORK statement to commit transactions and the ROLLBACK WORK statement to back out transactions. |
The embedded examples include the following statements, clauses, functions and predicates.
|
Statements: |
Clauses: |
Functions: |
Predicates: |
|---|---|---|---|
|
CLOSE |
FROM |
AVG |
EXISTS |
With regard to the SELECT statement listed previously, note that in the examples the select-statement form of the SELECT statement is a component of the DECLARE CURSOR statement, and that the examples could be executed interactively by omitting the "DECLARE CURSOR FOR" clause. See DECLARE CURSOR for more information on the DECLARE CURSOR statement and SELECT for more information on the SELECT statement.
Note: All examples use the CUSTOMERS and ORDERS tables listed in Sample Data Tables.
For examples using other SQL statements, such as CREATE and DROP, see the appropriate chapter in the section starting on Using the Interactive SQL Service Facility.
For examples involving the use of dynamic SQL, see Dynamic SQL. Also see the descriptions and examples of the dynamic SQL statements in SQL Statements.
|
Copyright © 2014 CA.
All rights reserved.
|
|