Saturday, 25 August 2012

RDBMS Query As of Unit test Q Paper:


   1)      SQL> create table sales_order(ord_no number, ord_date date,clint_name varchar2(20),dely_date date,ord_stat varchar2(20),ord_amt number(10));
SQL> insert into sales_order values(001,'12-jan-11','SUJIT ROY','20-jan-11','In Process',1200);
SQL> insert into sales_order values(002,'25-jan-11','RAJU BASU','27-jan-11','Cancelled',1000);
SQL> insert into sales_order values(003,'01-feb-12','GOUTAM SEN','05-feb-12','Fulfilled',2100);
SQL> insert into sales_order values(004,'23-mar-12','DIPLIP BASU','25-mar-12','Fulfilled',3000);
SQL> insert into sales_order values(005,'03-feb-12','S.RAMAN','07-feb-12','In Process',2500);

       a)      SQL> select * from sales_order where to_char(ord_date,'MM')='01';

       b)      SQL> select count(ord_no) from sales_order where ord_amt>=2000;

       c)       SQL> select * from sales_order where ord_stat='Fulfilled';

       d)      SQL> update sales_order set ord_stat='Cancelled' where ord_no=005;

       e)      SQL> select * from sales_order order by dely_date desc;

        f)       SQL> select avg(ord_amt) from sales_order;

       g)      SQL> delete from sales_order where ord_stat='Cancelled';
satta king 786