NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
S-31
Examples—SELECT
>> VOLUME $VOL1.SALES;
>> SELECT ORDERNUM, SUM (QTY_ORDERED * PRICE)
+> FROM PARTS P, ODETAIL O
+> WHERE O.PARTNUM = P.PARTNUM AND ORDERNUM IN
+> (SELECT ORDERNUM FROM ORDERS WHERE CUSTNUM IN
+> (SELECT CUSTNUM FROM CUSTOMER
+> WHERE STATE = "CALIFORNIA" ) )
+> GROUP BY ORDERNUM;
The following SQLCI example selects the value in the AUDIT column of the FILES
catalog table in the PERSNL catalog. By displaying this column, you can see
whether a table is defined as audited (Y) or nonaudited (N).
>> SELECT AUDIT FROM PERSNL.FILES
+> WHERE FILENAME = "\SYS1.$VOL1.PERSNL.JOB";
AUDIT
-----
Y
--- 1 row(s) selected.
The following SQLCI example uses a table, T, that has a column, C, of data type
CHARACTER. There are n possible values of C, any of which can occur multiple
times. The query returns the percent distribution of any value of C across the entire
table.
Sample Table T:
CI
-- -
N1 1
N1 4
N1 6
N2 2
N3 3
N3 5