Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


Question:The EMPLOYEE table contains the following columns:


The EMPLOYEE table contains the following columns:

EMPLOYEE_ID  NUMBER  NOT NULL
EMP_LNAME    VARCHAR2(20)  NOT NULL
EMP_FNAME    VARCHAR2(10)  NOT NULL
DEPT_ID      NUMBER
SALARY       NUMBER(9,2)

The user needs to retrieve information on employees that have the same department id and salary as an employee id that they will enter. The query results should include employees that do not have a salary, but not the employee that the user entered.
Which statement will return the desired result?
a.        SELECT  *
FROM     employee
WHERE  (dept_id, NVL(salary, 0)) IN
           (SELECT  dept_id, NVL(salary, 0)
            FROM     employee
            WHERE  employee_id = &&1)
AND employee_id <> &&1;
b.        SELECT  *
FROM     employee
WHERE  (dept_id, salary) IN
          (SELECT  dept_id, NVL(salary, 0)
           FROM     employee
           WHERE  employee_id = &1);
c.        SELECT  *
FROM     employee
WHERE  (department, salary) NOT IN
         (SELECT  department, salary)
          FROM     employee
          WHERE  employee_id = &1);
d.        SELECT  *
FROM     employee
WHERE  (dept_id, salary) IN
           (SELECT  dept_id, salary)
            FROM     employee
            WHERE  employee_id = &1
            AND       salary IS NULL);

asked Sep 13, 2013 in MYSQL by anonymous
edited Sep 12, 2013
0 votes
18 views



Related Hot Questions



Government Jobs Opening


...