Oracle Database: Exadata and SQL Essentials
Quiz covering Oracle Exadata Hybrid Columnar Compression features, CELL_OFFLOAD parameters, and SQL query techniques including MERGE statements, subqueries, views, sequences, roles, and indexing.
Questions
In which scenario would an index be most useful?
- The indexed column is declared as NOT NULL.
- The indexed columns are used in the FROM clause.
- The indexed columns are part of an expression.
- The indexed column contains a wide range of values.
When should you create a role? (Choose two.)
- To simplify the process of creating new users using the CREATE USER xxx IDENTIFIED by yyy statement
- to grant a group of related privileges to a user
- when the number of people using the database is very high
- to simplify the process of granting and revoking privileges
- to simplify profile maintenance for a user who is constantly traveling
Which two statements about sequences are true? (Choose two.)
- You use a NEXTVAL pseudo column to look at the next possible value that would be generated from a sequence, without actually retrieving the value.
- You use a CURRVAL pseudo column to look at the current value just generated from a sequence, without affecting the further values to be generated from the sequence.
- You use a NEXTVAL pseudo column to obtain the next possible value from a sequence by actually retrieving the value from the sequence.
- You use a CURRVAL pseudo column to generate a value from a sequence that would be used for a specified database column.
- If a sequence starting from a value 100 and incremented by 1 is used by more than one application, then all of these applications could have a value of 105 assigned to their column whose value is being generated by the sequence.
- You use a REUSE clause when creating a sequence to restart the sequence once it generates the maximum value defined for the sequence.
Which operator can be used with a multiple-row subquery?
- =
- LIKE
- BETWEEN
- NOT IN
- IS
- <>
You created a view called EMP_DEPT_VU that contains three columns from the EMPLOYEES and DEPARTMENTS tables: EMPLOYEE_ID, EMPLOYEE_NAME AND DEPARTMENT_NAME. The DEPARTMENT_ID column of the EMPLOYEES table is the foreign key to the primary key DEPARTMENT_ID column of the DEPARTMENTS table. You want to modify the view by adding a fourth column, MANAGER_ID of NUMBER data type from the EMPLOYEES table. How can you accomplish this task?
- ALTER VIEW emp_dept_vu (ADD manager_id NUMBER);
- MODIFY VIEW emp_dept_vu (ADD manager_id NUMBER);
- ALTER VIEW emp_dept_vu AS SELECT employee_id,employee_name, department_name,manager_id FROM employees e,departments d WHERE e.department_id = d.department_id;
- MODIFY VIEW emp_dept_vu AS SELECT employee_id, employee_name, department_name, manager_id FROM employees e, departments d WHERE e.department_id = d.department_id;
- CREATE OR REPLACE VIEW emp_dept_vu AS SELECT employee_id, employee_name, department_name, manager_id FROM employees e, departments d WHERE e.department_id=d.department_id;
Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables: EMPLOYEES EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) HIRE_DATE DATE NEW EMPLOYEES EMPLOYEE_ID NUMBER Primary Key NAME VARCHAR2(60) Which UPDATE statement is valid?
- UPDATE new_employees SET name = (SELECT last_name|| first_ name FROM employees WHERE employee_id =180) WHERE employee_id =180;
- UPDATE new_employees SET name = (SELECT last_name ||first_name FROM employees ) WHERE employee_ id =180;
- UPDATE new_employees SET name = (SELECT last_name || first_name FROM employees WHERE employee_id =180) WHERE employee_id =(SELECT employee_id FROM new employees);
- UPDATE new_employees SET name = (SELECT last name || first_name FROM employees WHERE employee_id = (SELECT employee_id FROM new_employees)) WHERE employee_id =180;
Which substitution variable would you use if you want to reuse the variable value without prompting the user each time?
- "&"
- ACCEPT
- PROMPT
- "&&"
Click the Exhibit button and examine the data in the EMPLOYEES table. Which three sub queries work? (Choose three.)
- SELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY department_id);
- SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY department_id);
- SELECT distinct department_id FROM employees WHERE salary > ANY(SELECT AVG(salary) FROM employees GROUP BY department_id);
- SELECT department_id FROM employees WHERE salary > ALL(SELECT AVG(salary) FROM employees GROUP BY department_id);
- SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM employees GROUP BY AVG(SALARY));
Which SQL statement retrieves the order ID, customer ID, and order total for the orders that are placed on the same day that Martin placed his orders?
- SELECT ord_id, cust_id, ord_total FROM orders, customers WHERE cust_name='Martin' AND ord_date IN ('18-JUL-2000','21-JUL-2000');
- SELECT ord_id, cust_id, ord_total FROM orders WHERE ord_date IN (SELECT ord_date FROM orders WHERE cust_id = (SELECT cust_id FROM customers WHERE cust_name = 'Martin'));
- SELECT ord_id, cust_id, ord_total FROM orders WHERE ord_date IN (SELECT ord_date FROM orders, customers WHERE cust_name = 'Martin');
- SELECT ord_ id, cust_id, ord_total FROM orders WHERE cust_id IN (SELECT cust_id FROM customers WHERE cust name = 'Martin');
Examine the structure of the EMPLOYEES and NEW EMPLOYEES tables: EMPLOYEES EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) HIRE_DATE DATE NEW EMPLOYEES EMPLOYEE_ID NUMBER Primary Key NAME VARCHAR2(60) Which MERGE statement is valid?
- MERGE INTO new_employees c USING employees e ON (c.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHED THEN INSERT VALUES(e.employee_id, e.first_name ||', '||e.last_name);
- MERGE new_employees c USING employees e ON (c.employee_id = e.employee_id) WHEN EXISTS THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHED THEN INSERT VALUES(e.employee_id, e.first_name ||', '||e.last_name);
- MERGE INTO new employees c USING employees e ON (c.employee_id = e.employee_id) WHEN EXISTS THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHES THEN INSERT VALUES(e.employee_id, e.first_name ||', '||e.last_name);
- MERGE new_employees c FROM employees e ON (c.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHED THEN INSERT INTO new_employees VALUES(e.employee_id, e.first_name ||'.'||e.last_name);
Which of the following is applicable for Exadata Hybrid Columnar Compression?
- a. The database stores the same column for a group of rows together
- b. The data block does not store the rows in the row-major format
- c. The database stores the identical rows together with a reference for each row
- d. Database operations works transparently against compressed objects without the need of changing application code
The Exadata Hybrid Columnar Compression is of following types
- a. Warehouse Compression & Online Archival Compression
- b. Basic Compression, Warehouse Compression & Online Archival Compression
- c. Basic Compression, OLTP Compression, Warehouse Compression & Online Archival Compression
- d. OLTP Compression, Warehouse Compression & Online Archival Compression
The database stores a set of rows in an internal structure called a compression unit in case of Exadata Hybrid Columnar Compression.
- a. Compression unit can span across multiple data blocks
- b. The value of particular column can span across multiple blocks
- c. If a column in a compression unit is updated, the database will take a lock only on the updated rows
- d. If a column in a compression unit is updated, the database will take a lock on the entire compression unit
When tables use Exadata Hybrid Columnar Compression, Oracle DML locks larger blocks of data (compression unit) which might reduce concurrency
- a. For basic and online archival compression inserted and updated rows are uncompressed
- b. Higher compression levels of Exadata Hybrid Columnar Compression are achieved only with data that is direct-path inserted
- c. High CPU overhead in case Warehouse compression
- d. Conventional inserts and updates are supported in Exadata Hybrid Columnar Compression but the extent of compression is low
Which of the following statement(s) is (are) true?
- a. COMPRESS FOR QUERY HIGH should be used where load performance is critical
- b. COMPRESS FOR QUERY LOW should be used where load performance is critical
- c. COMPRESS FOR ARCHIVE HIGH should be used for rarely accessed application
- d. COMPRESS FOR ARCHIVE HIGH should be used for heavily accessed application
DBMS_COMPRESSION package helps to determine the expected compression level. COMPRESSION and COMPRESS_FOR column of user_tables provides whether compression is enabled or disabled and compression method respectively
- a. CELL_OFFLOAD_PLAN_DISPLAY
- OPT_PARAM
- c. CELL_OFFLOAD_PROCESSING
- d. CELL_PARTITION_LARGE_EXTENTS
CELL_OFFLOAD_PROCESSING parameter can be changed at system or session level
- True
- False
CELL_OFFLOAD_PROCESSING parameter effect can be also achieved by OPT_PARAM hint
- True
- False
- CELL_OFFLOAD_PROCESSING parameter can be used to compare the performance of Exadata Cell with conventional storage
- True
- False
- CELL_OFFLOAD_PLAN_DISPLAY parameter determines whether the SQL EXPLAIN PLAN command displays the predicates that can be evaluated by Exadata Cell as STORAGE predicates for a given SQL command
- True
- False