1z0-071 Exam - Oracle Database 12c SQL

certleader.com

Q1. Evaluate the following SQL query;

What would be the outcome?

A. 200

B. 16

C. 160

D. 150

E. 100

Answer:

Explanation: Function Purpose

ROUND(column|expression, n) Rounds the column, expression, or value to n decimal places or, if n is omitted, no decimal places (If n is negative, numbers to the left of decimal point are rounded.)

TRUNC(column|expression, n) Truncates the column, expression, or value to n decimal places or, if n is omitted, n defaults to zero

Q2. See the Exhibit and Examine the structure of the CUSTOMERS table:

Using the CUSTOMERS table, you need to generate a report that shows an increase in the credit limit by 15% for all customers. Customers whose credit limit has not been entered should have the message "Not Available" displayed.

Which SQL statement would produce the required result?

A. SELECT NVL(cust_credit_limit,'Not Available')*.15 "NEW CREDIT" FROM customers;

B. SELECT NVL(cust_credit_limit*.15,'Not Available') "NEW CREDIT" FROM customers;

C. SELECT TO_CHAR(NVL(cust_credit_limit*.15,'Not Available')) "NEW CREDIT" FROM customers;

D. SELECT NVL(TO_CHAR(cust_credit_limit*.15),'Not Available') "NEW CREDIT" FROM customers;

Answer:

Explanation: NVL Function

Converts a null value to an actual value:

Data types that can be used are date, character, and number. Data types must match:

– NVL(commission_pct,0)

– NVL(hire_date,'01-JAN-97')

– NVL(job_id,'No Job Yet')

Q3. Which statement is true regarding the default behavior of the ORDER BY clause?

A. In a character sort, the values are case-sensitive

B. NULL values are not considered at all by the sort operation

C. Only those columns that are specified in the SELECT list can be used in the ORDER BY clause

D. Numeric values are displayed from the maximum to the minimum value if they have decimal positions

Answer: A

Explanation:

Character Strings and Dates

Character strings and date values are enclosed with single quotation marks. Character values are case-sensitive and date values are format-sensitive. The default date display format is DD-MON-RR.

Q4. Evaluate the following statement: INSERT ALL

WHEN order_total < 10000 THEN INTO small_orders

WHEN order_total > 10000 AND order_total < 20000 THEN

INTO medium_orders

WHEN order_total > 2000000 THEN INTO large_orders

SELECT order_id, order_total, customer_id FROM orders;

Which statement is true regarding the evaluation of rows returned by the subquery in the INSERT statement?

A. They are evaluated by all the three WHEN clauses regardless of the results of the evaluation of any other WHEN clause.

B. They are evaluated by the first WHEN clause. If the condition is true, then the row would be evaluated by the subsequent WHEN clauses.

C. They are evaluated by the first WHEN clause. If the condition is false, then the row would be evaluated by the subsequent WHEN clauses.

D. The INSERT statement would give an error because the ELSE clause is not present for support in case none of the WHEN clauses are true.

Answer: A

Q5. You are designing the structure of a table in which two columns have the specifications:

COMPONENT_ID - must be able to contain a maximum of 12 alphanumeric characters and uniquely identify the row

EXECUTION_DATETIME - contains Century, Year, Month, Day, Hour, Minute, Second to the maximum precision and is used for calculations and comparisons between components.

Which two options define the data types that satisfy these requirements most efficiently?

A. The EXECUTION_DATETIME must be of INTERVAL DAY TO SECOND data type.

B. The EXECUTION _DATETIME must be of TIMESTAMP data type.

C. The EXECUTION_DATATIME must be of DATE data type.

D. The COMPONENT_ID must be of ROWID data type.

E. The COMPONENT_ID must be of VARCHAR2 data type.

F. The COMPONENT_ID column must be of CHAR data type.

Answer: C,E

Q6. View the Exhibit and examine the structure of ORDERS and ORDER_ITEMS tables.

ORDER ID is the primary key in the ORDERS table. It is also the foreign key in the ORDER_ITEMS table wherein it is created with the ON DELETE CASCADE option.

Which DELETE statement would execute successfully?

A. DELETE order_id FROM orders

WHERE order_total < 1000;

B. DELETE orders

WHERE order_total < 1000;

C. DELETE

FROM orders

WHERE (SELECT order_id FROM order_items);

D. DELETE orders o, order_items i WHERE o.order id = i.order id;

Answer: B