The SELECT statement extracts data from a relational table that meets the criteria you specify. You can use the SELECT statement by itself or within another statement (then called a subquery).
LSQL SELECT columnlist|*asterisk [INTO (hostvarlist)] FROM tablename [WHERE criteria] [GROUP BY criteria [HAVING criteria]] [ORDER BY criteria]
|
Operand |
Explanation |
|---|---|
|
* |
Selects all columns in a table. |
|
columnlist |
Selects values only from the columns you name. Each column name must be separated by a comma. |
|
criteria |
The search criteria that you are using to match values in the specified columns. |
|
FROM |
Clause used to specify the tablename from which data is being selected. |
|
GROUP BY |
Clause used to summarize multiple rows of data into single rows based on the specified criteria. |
|
HAVING |
Clause used, only with a GROUP BY clause, to further limit the output of the statement based on the specified criteria. |
|
hostvarlist |
The host variables in which to store the selected column values. In a cursor declaration, do not use this parameter since this function is accomplished with the FETCH statement. |
|
ORDER BY |
Clause used to specify the order of the statement output. |
|
tablename |
The name of the relational table from which you are selecting. |
Notes:
Examples
LSQL SELECT * FROM APPLICATIONS
LSQL SELECT APPL_ID FROM APPLICATIONS
LSQL SELECT APPL_ID FROM APPLICATIONS WHERE STATUS='DOWN'
LSQL DECLARE CURSOR STATDOWN FOR SELECT APPL_ID, STATUS FROM APPLICATIONS WHERE STATUS = 'DOWN'
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |