Make Your Search Easy ! :) Use me

Thursday, February 23, 2017

SQL / Queries

Table : WORKER




Table : PAYLEVEL



a)To display the details of all workers in descending order of dob.
    ANS: select * from worker order by dob desc;

b)To display name and designation of those workers, whose plevel is either P001 or P002.
    ANS: select name,desig from worker where plevel in ('P001','P002');

c)To display the content of all the workers, whose dob is in between 19-01-1984 and 18-01-1987.
    ANS: select * from worker where dob between '19-JAN-84' and '18-JAN-87';

d)To add a new row with the following details :
   ECODE = 19
   NAME = Daya Kishore
   DESIGNATION = OPERATOR
   PLEVEL = P003
   DATE OF JOINING = 19-06-2008
   DATE OF BIRTH = 11-06-1984

    ANS: insert into worker values (19,'Daya Kishore','Operator','P003','19-JUN-08','11-JUN-84');

e)To display name and pay of workers whose ecode is less than 13
    ANS: select name,pay from worker w,paylevel p where w.plevel=p.plevel amd w.ecode<13;

f)To display the name and total payment of all workers.

    ANS: select name,pay+allowance as payment from worker w,paylevel p where w.plevel=p.plevel;


No comments:

Post a Comment