102. Evaluate the following command:
CREATE TABLE employees
(employee_id NUMBER(2) PRIMARY KEY,
last_name VARCHAR2(25) NOT NULL,
department_id NUMBER(2),job_id VARCHAR2(8),salary NUMBER(10,2));
You issue the following command to create a view that displays the IDs and
last names of the sales staff in the organization:
CREATE OR REPLACE VIEW sales_staff_vu AS
SELECT employee_id, last_name,job_id
FROM employees
WHERE job_id LIKE 'SA_%' WITH CHECK OPTION;
Which statements are true regarding the above view? (Choose all that apply.)
A. It allows you to insert details of all new staff into the EMPLOYEES table.
B. It allows you to delete the details of the existing sales staff from the
EMPLOYEES table.
C. It allows you to update the job ids of the existing sales staff to any
other job id in the EMPLOYEES table.
D.It allows you to insert the IDs, last names and job ids of th e sales staff
from the view if it is used in multitable INSERT statements.
D 翻译: 他允许你使用多行插入语句根据视图中的销售经理的ID, last name和job id去插入
解释: insert the IDs, last names and job ids of the sales staff from the view也就是说数据来自于视图,而不是向视图插入数据,所以这是允许的
CREATE TABLE employees
(employee_id NUMBER(2) PRIMARY KEY,
last_name VARCHAR2(25) NOT NULL,
department_id NUMBER(2),job_id VARCHAR2(8),salary NUMBER(10,2));
You issue the following command to create a view that displays the IDs and
last names of the sales staff in the organization:
CREATE OR REPLACE VIEW sales_staff_vu AS
SELECT employee_id, last_name,job_id
FROM employees
WHERE job_id LIKE 'SA_%' WITH CHECK OPTION;
Which statements are true regarding the above view? (Choose all that apply.)
A. It allows you to insert details of all new staff into the EMPLOYEES table.
B. It allows you to delete the details of the existing sales staff from the
EMPLOYEES table.
C. It allows you to update the job ids of the existing sales staff to any
other job id in the EMPLOYEES table.
D.It allows you to insert the IDs, last names and job ids of th e sales staff
from the view if it is used in multitable INSERT statements.
Answer: BD
通过user_updatable_columns表能够查询到该表或者视图是否可更新。
SQL> select * from user_updatable_columns t where t.table_name='SALES_STAFF_VU';
OWNER TABLE_NAME COLUMN_NAME UPDATABLE INSERTABLE DELETABLE
------------------------------ ------------------------------ ------------------------------ --------- ---------- ---------
A SALES_STAFF_VU EMPLOYEE_ID YES YES YES
A SALES_STAFF_VU LAST_NAME YES YES YES
A SALES_STAFF_VU JOB_ID YES YES YES
D 翻译: 他允许你使用多行插入语句根据视图中的销售经理的ID, last name和job id去插入
解释: insert the IDs, last names and job ids of the sales staff from the view也就是说数据来自于视图,而不是向视图插入数据,所以这是允许的