suppose I have two table one Emp and other is dpt.
Emp table has a field ,dept id,name ,sal and dpt table has a
field dept id,dept name.
Now I want to find out the emplyee list whose sal is between
2000-3000 from dept x.

Answer Posted / sravan

You can also solve it by using sub-query

SELECT DISTINCT NAME FROM EMP E
WHERE SAL>2000 AND SAL<3000
AND E.DEPTID IN (SELECT D.DEPTID FROM DPT D
WHERE DEPTNAME='X');

thanks

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is server name sql?

688


What is the usage of sql functions?

660


Explain the rollback statement?

671


Why is a trigger used?

622


what is dbms? : Sql dba

630






Why we use join in sql?

622


Can we commit in trigger?

630


What is procedure in pl sql?

615


What is synchronized subquery?

709


Why do we need view in sql?

642


how to get a list of columns in an existing table? : Sql dba

633


What is nested table in pl sql?

643


what are the different type of normalization? : Sql dba

644


What is a ddl command?

622


What is exception? What are the types of exceptions?

679