#!/bin/sh
# this script generates the SQL queries

echo "=========Start of NewQuery Single User Run===================="
date

echo "Q7A"

cat <<END | $DBMS
select count(*) from bench where s1 like ${STRDELIM}abc%${STRDELIM} 
$SQLDELIM
END

date

echo "Q7B"

for i in s2 s3 s4 s5 s6 s7 s8
do
cat <<END | $DBMS
select count(*) from bench where $i like ${STRDELIM}abc%${STRDELIM} 
$SQLDELIM
END
done

date

echo "Q7C"

cat <<END | $DBMS
select count(*) from bench where s2 like ${STRDELIM}a%${STRDELIM} 
$SQLDELIM
END

date

echo "Q8A"

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 30 and 31 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 32 and 33 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 34 and 35 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 36 and 37 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 38 and 39 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 40 and 41 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 42 and 43 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 44 and 45 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 46 and 47 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k + 1 where 
k100 between 48 and 49 
$SQLDELIM
END

date

echo "Q8B"

cat <<END | $DBMS
update bench set k100 = k100 + 1 where 
k500k between 30 and 50 
$SQLDELIM
END

date

echo "Q8C"

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 30 and 31 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 32 and 33 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 34 and 35 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 36 and 37 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 38 and 39 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 40 and 41 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 42 and 43 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 44 and 45 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 46 and 47 
$SQLDELIM
END

cat <<END | $DBMS
update bench set k500k = k500k - 1 where
k100 between 48 and 49 
$SQLDELIM
END

date

echo "Q8D"

cat <<END | $DBMS
update bench set k100 = k100 - 1 where
k500k between 30 and 50 
$SQLDELIM
END

date

echo "Q9"

cat <<END | $DBMS
select avg(k500k) from bench 
$SQLDELIM
END

date

echo "Q10"

cat <<END | $DBMS
select sum(k10) from bench 
$SQLDELIM
END

date
echo "===== End of NewQuery Single User Run============================="
