2 # Testing Join on 5 sales tables.
3 # CREATE TABLE writer (poet varchar(50) , anthology varchar(40) default NULL, copies_in_stock tinyint(4)) ;
4 # INSERT INTO writer VALUES ('Mongane Wally Serote','Tstetlo',3);
5 # INSERT INTO writer VALUES ('Douglas Livingstone', 'The Skull in the Mud',21);
6 # INSERT INTO writer VALUES ('Mongane Wally Serote', 'No Baby Must Weep',8);
7 # INSERT INTO writer VALUES ('Douglas Livingstone', 'A Littoral Zone',2);
8 # INSERT INTO writer VALUES ('Mongane Wally Serote', 'A Tough Tale',2);
9 # SELECT poet, MAX(copies_in_stock) , MIN(copies_in_stock) , AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet;
10 # SELECT poet, MAX(copies_in_stock), AVG(copies_in_stock) , SUM(copies_in_stock) FROM writer GROUP BY poet HAVING poet > 'E';
11 # This will give wrong value for min(tinyint datatype).
14 QUITFILE
=${PWD}/sql
/Aggregate
/quit.sql
18 REL_PATH
=`pwd`/sql
/Aggregate
20 echo "DROP TABLE writer;" >${REL_PATH}/drop_writer.sql
21 $CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/writer.sql
24 $CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/dropt1.sql
25 rm -f ${REL_PATH}/drop_writer.sql
29 $CSQL_INSTALL_ROOT/bin
/csql
-s ${REL_PATH}/drop_writer.sql
32 rm -f ${REL_PATH}/drop_writer.sql
36 rm -f ${REL_PATH}/drop_writer.sql