pg1 alter table student drop column marks; select * from student; alter table student modify(phno number(20));
pg2 select distinct publ from library; select * from library 2 order by title desc; select * from library 2 order by title asc; select * from library 2 where price between 525 and 555;
pg3 select dept, count(*) from empsal3 2 group by dept; select sum(salary) from empsal3; select max(salary),min(salary) from empsal3; select sum(salary),avg(salary) from empsal3 2 where dept='jdhui'; update empsal3 2 set salary=salary+3000 3 where dept='jdhui';
pg4 select * from purchase; select itemcode,name from items 2 where itemcode not in(select itemcode from purchase);
pg6 select c.custno,c.cname,a.accno,a.chequef from customer c,account a 2 where c.accno=a.accno and a.chequef='yes' and c.city='blore'; select c.cname,c.balance 2 from customer c, account a 3 where c.accno=a.accno and c.balance>3000 and a.accstauts='active'; select sum(c.balance) from customer c, account a 2 where c.accno=a.accno and a.branch='malleswaram';
pg9 declare a int; b int; begin a:=&a; b:=&b; if(a>b) then dbms_output.put_line('a is greatest'||a); else dbms_output.put_line('b is greatest'||b); end if; end; / value for a: 6 5: a:=&a; 5: a:=6; value for b: 4 6: b:=&b; 6: b:=4; greatest6
L procedure successfully completed.
/ value for a: 2 5: a:=&a; 5: a:=2; value for b: 4 6: b:=&b; 6: b:=4; greatest4
L procedure successfully completed.
pg10 declare i number:=1; n number; sum1 number:=0; begin n:=&n; while i<=n loop sum1:=sum1+i; dbms_output.put_line(i); i:=i+1; end loop; dbms_output.put_line('the sum is:'||sum1); end; / value for n: 10 6: n:=&n; 6: n:=10;
um is:55
L procedure successfully completed.
/ value for n: 20 6: n:=&n; 6: n:=20;
um is:210
L procedure successfully completed.
pg11 declare n number; fact number:=1; i number; begin n:=&n; for i in 1..n loop fact:=fact*i; end loop; dbms_output.put_line('factorial='||fact); end; / value for n: 5 6: n:=&n; 6: n:=5; rial=120
L procedure successfully completed.
/ value for n: 2 6: n:=&n; 6: n:=2; rial=2
L procedure successfully completed.
pg12 declare a number; b number; c number; procedure add(x in number,y in number,z in number) is begin c:=a+b; end; begin a:=&a; b:=&b; add(a,b,c); dbms_output.put_line('sum is:'||c); end; / value for a: 10 10: a:=&a; 10: a:=10; value for b: 20 11: b:=&b; 11: b:=20; s:30
L procedure successfully completed.
/ value for a: 40 10: a:=&a; 10: a:=40; value for b: 60 11: b:=&b; 11: b:=60; s:100
To insert a code use <i rel="pre">code_here</i>
To insert a quote use <b rel="quote">your_qoute</b>
To insert a picture use <i rel="image">url_image_here</i>