cat > script <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
select from loans;
select min from loans;
select min (amount), date from loans;
select avg (name) from loans;
select min (name) from loans;
select max (amount) from loans;
select max (distinct amount) from loans;
select max (date) from loans;
select sum (amount) from loans;
select sum (distinct amount) from loans dump into XX;
do 'cat XX';
select avg (amount) from loans;
select avg (unique amount) from table loans into XX;
do 'cat XX';
do 'rm XX';
select sum (amount) from loans where name match 'J*' or name match 'W*';
select sum (unique amount) from loans where name match 'J*' or name match 'W*';
select name, credit_limit from personnel;
select max (name) from loans, personnel where personnel.name = loans.name;
select sum (amount) from loans, personnel dump where personnel.name =
	loans.name;
select avg (unique credit_limit) from loans, personnel where
	credit_limit > 250 and loans.name = personnel.name;
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 script
cat > stdout <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
* name                                    date        amount

Mosca                       2 February  1981       $150.00
Jones                       7 February  1981        $33.95
Kilroy                     16 February  1981       $250.00
Wladislaw                  27 February  1981        $55.00
Jones                       3 April     1981        $25.00
Mosca                       4 May       1981       $200.00
Wladislaw                  12 May       1981        $25.00
Peterson                    6 June      1981        $50.00
Wladislaw                  25 June      1981        $75.00
Jones                      12 August    1981       $300.00
* *** Syntax Error: expecting a command
Error detected near the end of:
select min from 
*              MIN(amount)               date

                           2 February  1981
                           7 February  1981
                          16 February  1981
                          27 February  1981
                           3 April     1981
                           4 May       1981
                          12 May       1981
                           6 June      1981
                          25 June      1981
                          12 August    1981
                  $25.00
* 
*** Error: SQL-invoked routine 'avg' invalid or parameter(s) incompatible
* MIN(name)

Jones
*              MAX(amount)

                 $300.00
*     MAX(DISTINCT amount)

                 $300.00
*            MAX(date)

   12 August    1981
*              SUM(amount)

                 1163.95
* * 1138.95
*              AVG(amount)

                  116.40
* *     AVG(DISTINCT amount)

                  126.55
* *              SUM(amount)

                  513.95
*     SUM(DISTINCT amount)

                  488.95
* name             credit_limit

Kilroy                $500.00
Jones                 $500.00
Mosca                 $750.00
Waldislaw             $200.00
Peterson              $250.00
Scarlatti             $100.00
* MAX(name)

Peterson
* . 1008.95
* . AVG(DISTINCT credit_limit)

                    625.00
* 
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 stdout
cat > stdout.jp_euc <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
* name                                    date        amount

Mosca                       2 February  1981       $150.00
Jones                       7 February  1981        $33.95
Kilroy                     16 February  1981       $250.00
Wladislaw                  27 February  1981        $55.00
Jones                       3 April     1981        $25.00
Mosca                       4 May       1981       $200.00
Wladislaw                  12 May       1981        $25.00
Peterson                    6 June      1981        $50.00
Wladislaw                  25 June      1981        $75.00
Jones                      12 August    1981       $300.00
* *** Syntax Error: ޥɤɬפǤ
顼ζ᤯ǵƤޤ:
select min from 
*              MIN(amount)               date

                           2 February  1981
                           7 February  1981
                          16 February  1981
                          27 February  1981
                           3 April     1981
                           4 May       1981
                          12 May       1981
                           6 June      1981
                          25 June      1981
                          12 August    1981
                  $25.00
* 
*** Error: SQLǵư줿롼 'avg' ̵Ǥ뤫̵ʥѥ᡼ꤵƤޤ
* MIN(name)

Jones
*              MAX(amount)

                 $300.00
*     MAX(DISTINCT amount)

                 $300.00
*            MAX(date)

   12 August    1981
*              SUM(amount)

                 1163.95
* * 1138.95
*              AVG(amount)

                  116.40
* *     AVG(DISTINCT amount)

                  126.55
* *              SUM(amount)

                  513.95
*     SUM(DISTINCT amount)

                  488.95
* name             credit_limit

Kilroy                $500.00
Jones                 $500.00
Mosca                 $750.00
Waldislaw             $200.00
Peterson              $250.00
Scarlatti             $100.00
* MAX(name)

Peterson
* . 1008.95
* . AVG(DISTINCT credit_limit)

                    625.00
* 
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 stdout.jp_euc
cat > tag <<'+-+-+-+-+-END-OF-FILE-+-+-+-+-+'
Test for "select" command with options "max", "min", "sum" and "avg"
+-+-+-+-+-END-OF-FILE-+-+-+-+-+
chmod 644 tag
