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]
Parameters
Selects all columns in a table.
Selects the values only from the columns you name. Separate each column name by a comma.
Search criteria that you are using to match values in the specified columns.
Clause that is used to specify the tablename from which data is being selected.
Clause that is used to summarize multiple rows of data into single rows that are based on the specified criteria.
Clause used, only with a GROUP BY clause, to limit further the output of the statement that is based on the specified criteria.
Host variables in which to store the selected column values. In a cursor declaration, do not use this parameter because this function is accomplished with the FETCH statement.
Clause that is used to specify the order of the statement output.
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 © 2014 CA Technologies.
All rights reserved.
|
|