NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
D-48
Examples—DETAIL
Examples—DETAIL
The following commands specify a report in the format shown:
>> SET LIST_COUNT 0;
>> SELECT * FROM SALES.CUSTOMER ORDER BY CUSTNUM;
S> DETAIL CUSTNUM HEADING "Account",
+> CUSTNAME AS A20 HEADING "Name" CENTER,
+> CONCAT (CITY STRIP, ", ", STATE)
+> HEADING "Location" CENTER,
+> TAB 60, IF CREDIT = "A1" THEN ("***" );
The first two detail lines of this report might be:
Account Name Location
------- -------------------- --------------------------
21 CENTRAL UNIVERSITY PHILADELPHIA, PENNSYLVANIA ***
123 BROWN MEDICAL CO SAN FRANCISCO, CALIFORNIA
The following commands specify a report in a different format, as shown:
>> SELECT FIRST_NAME,LAST_NAME,DEPTNAME,MANAGER,AVG (SALARY)
+> FROM PERSNL.EMPLOYEE E, PERSNL.DEPT D
+> WHERE D.DEPTNUM = E.DEPTNUM
+> GROUP BY FIRST_NAME, LAST_NAME, DEPTNAME, MANAGER;
S> DETAIL DEPTNAME AS A20 HEADING "Dept." NAME DN,
+> CONCAT (FIRST_NAME STRIP, SPACE 1, LAST_NAME) AS A18
+> HEADING "Manager", COL 5 HEADING "Avg. Salary" NAME AVSAL;
Some sample lines of this report might be:
Dept. Manager Avg. Salary
-------------------- ------------------ -------------------
ASIA SALES SHERRIE WONG
45835.00
ENGINEERING ERIC BROWN
35000.00
MARKETING JACK RAYMOND
30166.67