ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 047-151

047-151

原创 Linux操作系统 作者:jbymy2000 时间:2012-03-19 10:35:26 0 删除 编辑
161. View the Exhibit and examine the data in EMPLOYEES and DEPARTMENTS tables.
In the EMPLOYEES table EMPLOYEE_ID is the PRIMARY KEY and DEPARTMENT_ID is
the FOREIGN KEY. In the DEPARTMENTS table DEPARTMENT_ID is the PRIMARY KEY.
Evaluate the following UPDATE statement:
UPDATE employees a SET department_id =
(SELECT department_id
FROM departments
WHERE location_id = '2100'),
(salary, commission_pct) =
(SELECT 1.1*AVG(salary), 1.5*AVG(commission_pct)
FROM employees b
WHERE a.department_id = b.department_id)
WHERE first_name||' '||last_name = 'Amit Banda';
What would be the outcome of the above statement?
A. It would execute successfully and update the relevant data.
B. It would not execute successfully because there is no LOCATION_ID 2100
in the DEPARTMENTS table.
C. It would not execute successfully because the condition specified with
the concatenation operator is not valid.
D. It would not execute successfully because multiple columns
(SALARY,COMMISSION_PCT)cannot be used in an UPDATE statement.
Answer: A
Eg:update dept a set deptid=
(select max(emp_no) from emp
where mgr_no=4),
paredeptid=(select avg(salary) from emp b
where a.deptid=b.emp_no)
where trim(name)||' '||trim(name)='1ee 1ee';

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

上一篇: 047-159
下一篇: 047-165
请登录后发表评论 登录
全部评论

注册时间:2012-01-10

  • 博文量
    416
  • 访问量
    214038