Make Your Search Easy ! :) Use me

Thursday, February 23, 2017

SQL / Queries

Table : EMP



Table : DEPT



a)List all employees' details whose name ends with S.
      ANS: select * from emp where ename like '%S';

b)List all Employee details whose comm is greater than 300 and salary is greater than 1200.
      ANS: select * from emp where comm > 300 and sal >1200;

c)Select all the employee who works in Boston.    
      ANS: select * from emp e,dept d where e.deptno=d.deptno and d.dname='BOSTON';

d)Update all empolyee salary by 15% who work in dept no. 30.
    ANS: update emp set sal = sal + sal*0.15 where deptno=30;

e)Enter a new employee detail, which as follows
    EMP NO = 7940
    ENAME = RITIK
    JOB = MANAGER
    MGR - 7566
    HIRE DATE = 1998-01-28
    SAL = 1225
    COMM = 100
    DEPT NO = 10

    ANS: insert into emp values(7940,'RITIK','MANAGER',7566,'28-JAN-98',1225,100,10);

No comments:

Post a Comment