42. Which three statements are true regarding views? (Choose three.)
A. Views can be created only from tables.
B. Views can be created from tables or other views.
C. Only simple views can use indexes existing on the underlying tables.
D. Both simple and complex views can use indexes existing on the underlying tables.
E. Complex views can be created only on multiple tables that exist in the same schema.
F. Complex views can be created on multiple tables that exist in the same or different schemas.
Answer: BDF
A. Views can be created only from tables.
B. Views can be created from tables or other views.
C. Only simple views can use indexes existing on the underlying tables.
D. Both simple and complex views can use indexes existing on the underlying tables.
E. Complex views can be created only on multiple tables that exist in the same schema.
F. Complex views can be created on multiple tables that exist in the same or different schemas.
SQL> create or replace view v_emp as select * from emp;
View created
SQL> create or replace view v_emp2 as select empno,ename from emp;
View created
b对。a不对
SQL> create or replace view v as select e.department_id,e.job_id,sum(e.salary) as sum_sal from employees e group by e.department_id,e.job_id;
View created
SQL> create index idx_department_id on employees(department_id);
Index created
SQL> explain plan for select * from v where department_id = 10;
Explained
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 501232408
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 38 | 3
| 1 | HASH GROUP BY | | 1 | 38 | 3
| 2 | TABLE ACCESS BY INDEX ROWID| EMPLOYEES | 1 | 38 | 2
|* 3 | INDEX RANGE SCAN | IDX_DEPARTMENT_ID | 1 | | 1
--------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
3 - access("E"."DEPARTMENT_ID"=10)
Note
-----
- dynamic sampling used for this statement (level=2)
19 rows selected
d对 c不对
SQL> create or replace view v as select dept.deptno,sum(emp.sal) as sum_sal from test.dept inner join scott.emp on emp.deptno = dept.deptno group by dept.deptno;
View created
f对 e不对
Answer: BDF