视图怎么可以[color=#FF0000]allows the users to insert rows?[/color]?

yekai19830907 2009-03-08 03:12:14
Examine the structure of the EMPLOYEES table:

Column name Data type Remarks
EMPLOYEE_ID NUMBER NOT NULL, Primary Key
EMP_NAME VARCHAR2(30)
JOB_ID VARCHAR2(20) NOT NULL
SAL NUMBER
MGR_ID NUMBER References EMPLOYEE_ID column
DEPARTMENT_ID NUMBER
Foreign key to DEPARTMENT_ID column
of the DEPARTMENTS table


You need to create a view called EMP_VU that allows the users to insert rows through the view.
Which SQL statement, when used to create the EMP_VU view, allows the users to insert rows?

A. CREATE VIEW emp_vu AS
SELECT employee_id, emp_name,
department_id
FROM employees
WHERE mgr_id IN (102, 120);

B. CREATE VIEW emp_vu AS
SELECT employee_id, emp_name, job_id,
department_id
FROM employees
WHERE mgr_id IN (102, 120);

C. CREATE VIEW emp_vu AS
SELECT department_id, SUM(sal) TOTALSAL
FROM employees
WHERE mgr_id IN (102, 120)
GROUP BY department_id;

D. CREATE VIEW emp_vu AS
SELECT employee_id, emp_name, job_id,
DISTINCT department_id
FROM employees;


Answer: B


这道题目为什么是B呢?视图怎么可以allows the users to insert rows?
...全文
101 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
oraclelogan 2009-03-08
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 vc555 的回复:]
job _id要求not null,所以A错。

C中有聚合函数,所以错。

D这种方法连view都建不起,何谈insert了。
[/Quote]

正解啊,楼上说的不错的!
vc555 2009-03-08
  • 打赏
  • 举报
回复
job _id要求not null,所以A错。

C中有聚合函数,所以错。

D这种方法连view都建不起,何谈insert了。

2,668

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 认证与考试
社区管理员
  • 认证与考试社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧