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
Can a foreign key be null?
What are synonyms in sql?
Do we need to create index on primary key?
Why do we need a foreign key?
How to call shell script from pl sql procedure?
how to convert character strings to numeric values? : Sql dba
What does stand for in sql?
how to get @@error and @@rowcount at the same time? : Sql dba
how to create a test table in your mysql server? : Sql dba
What is a boolean in sql?
The in operator may be used if you know the exact value you want to return for at least one of the columns.
What is synchronized subquery?
How can the performance of a trigger be improved?
how can we destroy the session, how can we unset the variable of a session? : Sql dba
How many sql statements are used? Define them.