Q1.all the depts which has more then 10 empls?
Q2.all the dept which does not have any emply?
Q3 all the emp which does not have any dept?
Q4 get all the emply detais with the dept details it dept is
exit otherwise any emp details?
Q5 how to debugg the dynamic sql and packages?











Answers were Sorted based on User's Feedback



Q1.all the depts which has more then 10 empls? Q2.all the dept which does not have any emply? Q3 a..

Answer / ramya pisharody

Ans-1:

SELECT DEPTNO, COUNT(*) FROM EMP
GROUP BY DEPTNO
HAVING COUNT(*)>10;

Is This Answer Correct ?    3 Yes 0 No

Q1.all the depts which has more then 10 empls? Q2.all the dept which does not have any emply? Q3 a..

Answer / girija shankar dash

ANS-2:

SELECT department_id,COUNT(employee_id) AS "NO. OF EMPLOYEES"
FROM employees
GROUP BY department_id
HAVING COUNT(employee_id) = 0;

DEPARTMENT_ID NO. OF EMPLOYEES
201 0
311 0

Is This Answer Correct ?    3 Yes 2 No

Q1.all the depts which has more then 10 empls? Q2.all the dept which does not have any emply? Q3 a..

Answer / girija shankar dash

ANS-3:

SELECT employee_id , department_id
FROM employees
WHERE department_id IS NULL;

Is This Answer Correct ?    2 Yes 1 No

Q1.all the depts which has more then 10 empls? Q2.all the dept which does not have any emply? Q3 a..

Answer / ajit

ANS - 2
select d.deptno, dname, loc
from emp e, dept d
where e.deptno(+) = d.deptno
and e.deptno is null;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

Explain the usage of WHERE CURRENT OF clause in cursors ?

4 Answers   Satyam,


What are the indexing methods?

0 Answers  


How many types of indexes are there in sql?

0 Answers  


sales persons should always receive commission of 100 at least. employees who r not sales persons should never receive commission.(Triggers)

1 Answers   Fidelity, Oracle,


Which are the different types of indexes in sql?

0 Answers  






Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10

0 Answers  


What are operators available in sql?

0 Answers  


In a table only one column how to update rows

5 Answers   Microsoft,


Can you have more than one trigger on a table?

0 Answers  


How can you save or place your msg in a table?

0 Answers  


Is sql dba a good career? : SQL DBA

0 Answers  


What is integrity in sql?

0 Answers  


Categories