Structure Query Language, C programming, Java, Servlet, Jsp, Unix

Friday, 30 March 2012

Write a script for generating a mark sheet after reading data from a file. File contains student roll no, name , marks of three subjects.


len=`cat student.txt | wc -l`
i=1
echo "\n\n\tSTUDENT MARKSHEET"
echo "\t=================\n"
echo "NAME \t \t TOTAL \t \t PERCENTAGE"
echo "====================================================="
while [ $i -le $len ]
do
record=`head -n $i student.txt | tail -n 1`
total=0
for (( j=2 ; $j < 5 ; j=`expr $j + 1` ))
do
marks=`echo $record | cut -d " " -f $j`
total=`expr $total + $marks`
done
name=`echo $record | cut -d " " -f 1`
per=`expr $total / 3`
echo "$name \t \t $total \t \t $per %"
i=`expr $i + 1`
done

Table Updations.


1) Change the s_order_date of cllient_no'C00001' to 24/07/96

update sales_order
set s_order_date='24-jul-96'
where client_no='C00001';

2) Change the selling price of '1.44 Drive' to Rs. 1150.00

update product_master set sell_price=1150 where  description='1.44 Drive';

3) Delete the record with order no 'O19001' from the order table

delete from sales_order where s_order_no='O19001';

4) Delete all the records having delivery date before 10-jul-96

delete sales_order where dely_date<'10-jul-96'; 

5) Change the city of client_no 'C00005' to 'Bombay'

update client_master set city='Bombay' where client_no='C00005';

6) Change the delivery date of order no 'O10008' to 16-08-96

update sales_order
set dely_date='16-aug-96'
where s_order_no='O10008';

7) Change the bal_due of client_no 'C00001' to 1000

update client_master
set bal_due=1000
where client_no='C00001';

8) Change the cost price of '1.22 Floppy Drive' to Rs.950.00

update product_master
set cost_price=950
where description='1.22 Floppy Drive'