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.

Answers were Sorted based on User's Feedback



suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dp..

Answer / mai

Select Name
From Emp e inner join Dpt d
on d.dptid=e.dptid
Where sal>=2000 And sal<=3000
And dptname='x'

Is This Answer Correct ?    18 Yes 5 No

suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dp..

Answer / selvaraj v , anna university

SELECT * FROM EMP E,DEPTS D WHERE E.DEPT_ID=D.DEPT_ID AND
E.SALARY BETWEEN 2000 AND 3000 ORDER BY EMP_NO;

Is This Answer Correct ?    14 Yes 4 No

suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dp..

Answer / manasa

SELECT e.name,d.dept from employee e INNERJOIN dept d ON e.deptid=d.deptid WHERE e.salary between 2000 AND 3000

Is This Answer Correct ?    1 Yes 0 No

suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dp..

Answer / om patel

SELECT E.ENAME FROM EMP E ,DEPT D WHERE E.DEPTNO=D.DEPTNO
AND SAL BETWEEN 2000 AND 3000 AND D.DNAME='X';

Is This Answer Correct ?    2 Yes 2 No

suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dp..

Answer / 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

suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dp..

Answer / abhishekjaiswal

select e.department_id,e.last_name,e.salary,d.department_name from employees e,
departments d 
where e.department_id=d.department_id and 
e.salary between 2000 and 10000 
and lower(d.department_name)='finance'
/
Out put
DEPARTMENT_ID LAST_NAME                     SALARY DEPARTMENT_NAME
------------- ------------------------- ---------- --------------------
          100 Faviet                          9000 Finance
          100 Chen                            8200 Finance
          100 Sciarra                         7700 Finance
          100 Urman                           7800 Finance

Is This Answer Correct ?    0 Yes 0 No

suppose I have two table one Emp and other is dpt. Emp table has a field ,dept id,name ,sal and dp..

Answer / ragunath

select name from Emp where Sal between 2000 and 3000

Is This Answer Correct ?    4 Yes 14 No

Post New Answer

More SQL PLSQL Interview Questions

Does SQL*Plus contains pl/sql Engine?

1 Answers   TCS,


what are the 'mysql' command line arguments? : Sql dba

0 Answers  


What is vector point function?

0 Answers  


Why do we need view in sql?

0 Answers  


Show the two pl/sql cursor exceptions.

0 Answers  






If we have n no of columns in a table, can we add new column in that table with not null constraint?

2 Answers  


What is indexing oracle sql?

0 Answers  


What is memory optimized table?

0 Answers  


hi this is nakka i have been looking for 1+ exp in oracle sql,plsql developer positions also have knoledge on d2k i am not getting proper walkins how to know it? where can i find it?

5 Answers  


How to display the current date in sql?

0 Answers  


SELECT emp_num, years, SUM(salary) FROM sales UNION ALL SELECT emp_id, SUM(takehomepay) FROM marketing What error is present in the sample code above? 1. Queries being combined with the UNION ALL statement are not allowed to have SELECT lists with a different number of expressions. 2. You are not allowed to use aggregate functions within two queries joined by a UNION ALL statement. 3. The UNION ALL statement incorrectly combines the "years" result from the first query with the "SUM (takehomepay)" result from the second query. 4. Unless the UNION ALL statement is replaced with a UNION statement, the queries will return duplicates. 5. The "emp_id" column from the second query must be renamed (or aliased) as "emp_num" so that it corresponds to the column name from the first query. Otherwise, the queries will not execute.

3 Answers  


what is the Default Libraries for Oracle Report 6i

0 Answers   IBM,


Categories