SQL/MX Quick Start (G06.24+, H06.03+)

Selecting Information From a Table
HP NonStop SQL/MX Quick Start523724-002
2-2
Displaying Selected Columns.
Tip
Using SELECT * is a short way of specifying all the columns in a table.
The result of SET SCHEMA stays in effect until the end of your session or until you
execute another SET SCHEMA.
The FROM clause is always required in the SELECT statement.
Displaying Selected Columns.
You can display a specific set of columns and rows of data by providing additional
information in the SELECT statement. Select columns by specifying the column
names.
Example
Display only the part number and quantity available in the PARTS table:
SELECT PARTNUM, QTY_AVAILABLE FROM PARTS;
Some selected rows are:
Part/Num Qty/Avail
-------- -----------
186 186
212 3525
244 4426
... ...
Tip
You can list column names in any order, but they must follow the keyword SELECT
and precede the keyword FROM. The columns appear in the order you specify.
Displaying Selected Rows
In a typical query, you retrieve selected rows that satisfy some criteria. To select
particular rows of data, specify the condition for selecting the data in a WHERE clause.
Example
Display the parts where the quantity available is less than 500:
SELECT PARTNUM, PARTDESC, QTY_AVAILABLE FROM PARTS
WHERE QTY_AVAILABLE < 500;
The selected rows are:
Part/Num Part Description Qty/Avail
-------- ------------------ -----------
186 186 Megabyte Disk 186