ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 047试题请教

047试题请教

原创 Linux操作系统 作者:taylorgao 时间:2010-09-26 19:01:10 0 删除 编辑
103. View the Exhibit and examine the structure of EMPLOYEES and JOB_HISTORY tables.
The EMPLOYEES table maintains the most recent information regarding salary, department, and job for
all the employees. The JOB_HISTORY table maintains the record for all the job changes for the
employees. You want to delete all the records from the JOB_HISTORY table that are repeated in the
EMPLOYEES table.
Which two SQL statements can you execute to accomplish the task? (Choose two.)

A. DELETE
FROM job_history j
WHERE employee_id =
(SELECT employee_id
FROM employees e
WHERE j.employee_id = e.employee_id)
AND job_id = (SELECT job_id
FROM employees e
WHERE j.job_id = e.job_id)

B. DELETE
FROM job_history j
WHERE (employee_id, job_id) = ALL
(SELECT employee_id, job_id
FROM employees e
WHERE j.employee_id = e.employee_id and j.job_id = e.job_id )

C. DELETE
FROM job_history j
WHERE employee_id =
(SELECT employee_id
FROM employees e
WHERE j.employee_id = e.employee_id and j.job_id = e.job_id )

D. DELETE
FROM job_history j
WHERE (employee_id, job_id) =
(SELECT employee_id, job_id
FROM employees e
WHERE j.employee_id = e.employee_id and j.job_id = e.job_id )

Answer: CD

感觉C有问题啊。无论subquery 使用什么条件,返回给outer query de 都是employee_id,就是说,job_id条件没起作用。
不知我理解的是否正确。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/88933/viewspace-675661/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 047试题请教
下一篇: 请教regexp_like
请登录后发表评论 登录
全部评论

注册时间:2010-09-26

  • 博文量
    13
  • 访问量
    21871