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

how to analyze tables with 'mysqlcheck'? : Sql dba

547


Is sql considered coding?

569


Is sql a scripting language?

521


What is indexing oracle sql?

562


What is AUTH_ID and AUTH_USER in pl/sql ?

1694






What is spool?

592


difference between anonymous blocks and sub-programs.

624


how do you login to mysql using unix shell? : Sql dba

568


How many types of privileges are available in sql?

739


How do you update f as m and m as f from the below table testtable?

1084


How to select unique records from a table?

571


What is the primary key?

538


Why do we use sql constraints?

662


How to call shell script from pl sql procedure?

625


What is procedure and function?

520