adding test scripts
[csql.git] / test / sql / Aggregate / testnw032.ksh
blobc75187fa950e42490dbda0a1c7abee6475d721e8
1 #!/bin/ksh
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
15 REL_PATH=.
16 if [ -s "$QUITFILE" ]
17 then
18 REL_PATH=`pwd`/sql/Aggregate
20 echo "DROP TABLE writer;" >${REL_PATH}/drop_writer.sql
21 $CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/writer.sql
22 if [ $? -ne 0 ]
23 then
24 $CSQL_INSTALL_ROOT/bin/csql -s ${REL_PATH}/dropt1.sql
25 rm -f ${REL_PATH}/drop_writer.sql
26 exit 1;
29 $CSQL_INSTALL_ROOT/bin/csql -o 4 -s ${REL_PATH}/drop_writer.sql
30 if [ $? -ne 0 ]
31 then
32 rm -f ${REL_PATH}/drop_writer.sql
33 exit 3;
36 rm -f ${REL_PATH}/drop_writer.sql
37 exit 0;