1z0-047 Exam - Oracle Database SQL Expert

certleader.com

Q1. View the Exhibit and examine the structure of the ORDER_ITEMS table. 

You need to display the ORDER_ID of the order that has the highest total value among all the orders in the ORDER_ITEMS table. 

Which query would produce the desired output? 

A. SELECT order_id 

FROM order_items 

WHERE(unit_price*quantity) = MAX(unit_price*quantity) 

GROUP BY order_id; 

B. SELECT order_id 

FROM order_items 

WHERE(unit_price*quantity) = (SELECT MAX(unit_price*quantity) FROM order_items) 

GROUP BY order_id; 

C. SELECT order_id 

FROM order_items 

WHERE (unit_price*quantity) = (SELECT MAX(unit_price*quantity) FROM order_items 

GROUP BY order_id); 

D. SELECT order_id 

FROM order_items 

GROUP BY order_id 

HAVING SUM(unit_price*quantity) =(SELECT MAX(SUM(unit_price*quantity)) 

FROM order_items GROUP BY order_id); 

Answer: D

Q2. Which three statements are true? (Choose three.) 

A. Only one LONG column can be used per table. 

B. ATIMESTAMP data type column stores only time values with fractional seconds. 

C. The BLOB data type column is used to store binary data in an operating system file. 

D. The minimum column width that can be specified for a varchar2 data type column is one. 

E. The value for a CHAR data type column is blank-padded to the maximum defined column width. 

Answer: ADE

Q3. View the Exhibit and examine the structure of the ORDERS and ORDERJTEMS tables. 

Evaluate the following SQL statement: 

SELECT oi.order_id, product_jd, order_date 

FROM order_items oi JOIN orders o 

USING(order_id); 

Which statement is true regarding the execution of this SQL statement? 

A. The statement would not execute because table aliases are not allowed in the JOIN clause. 

B. The statement would not execute because the table alias prefix is not used in the USING clause. 

C. The statement would not execute because all the columns in the SELECT clause are not prefixed with table aliases. 

D. The statement would not execute because the column part of the USING clause cannot have a qualifier in the SELECT list. 

Answer: D

Q4. Which two statements are true regarding the execution of the correlated subqueries? (Choose two.) 

A. The nested query executes after the outer query returns the row. 

B. The nested query executes first and then the outer query executes. 

C. The outer query executes only once for the result returned by the inner query. 

D. Each row returned by the outer query is evaluated for the results returned by the inner query. 

Answer: AD

Q5. Which three statements are true regarding single-row functions? (Choose three.) 

A. They can accept only one argument. 

B. They can be nested up to only two levels. 

C. They can return multiple values of more than one data type. 

D. They can be used in SELECT, WHERE, and ORDER BY clauses. 

E. They can modify the data type of the argument that is referenced. 

F. They can accept a column name, expression, variable name, or a user-supplied constant as arguments. 

Answer: DEF

Q6. Evaluate the following SELECT statement and view the Exhibit to examine its output: 

SELECT constraint_name, constraint_type, search_condition, r_constraint_name, delete_rule, status FROM user_constraints WHERE table_name = ORDERS 

Which two statements are true about the output? (Choose two.) 

A. Inthe secondcolumn, indicates a check constraint. 

B. TheSTATUS columnindicateswhether the tableiscurrently in use. 

C. The R_CONSTRAINT_NAME column givesthealternative name for the constraint. 

D. The column DELETE_RULE decides the state oftherelated rows inthechild tablewhenthe corresponding row is deleted from the parent table. 

Answer: AD

Q7. 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 allnewstaff into the EMPLOYEES table. 

B. Itallowsyou todeletethedetails of the existing sales staff fromtheEMPLOYEES table. 

C. It allows you to updatethejob ids oftheexisting 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 the sales staff from theviewif it is used in multitable INSERT statements. 

Answer: BD

Q8. Which two statements are true regarding operators used with subqueries? (Choose two. 

A. The NOT IN operator is equivalent to IS NULL 

B. The <ANY operator means less than the maximum. 

C. =ANY and =ALL operators have the same functionality. 

D. The IN operator cannot be used in single-row subqueries. 

E. TheNOT operator can be used with IN, ANY and ALL operators. 

Answer: BE

Q9. View the Exhibit and examine the ORDERS table. 

The ORDERS table contains data and all orders have been assigned a customer ID. Which statement would add a NOT NULL constraint to the CUSTOMER_ID column? 

A. ALTER TABLE orders 

ADD CONSTRAINT orders_cust_id_nn NOT NULL (customer_id); 

B. ALTER TABLE orders 

MODIFY customer_id CONSTRAINT orders_cust_id_nn NOT NULL; 

C. ALTER TABLE orders 

MODIFY CONSTRAINT orders_cust_id_nn NOT NULL (customer_id); 

D. ALTER TABLE orders 

ADD customer_id NUMBER(6)CONSTRAINT orders_cust_id_nn NOT NULL; 

Answer: B

Q10. View the Exhibit and examine the data in EMP and DEPT tables. 

In the DEPT table, DEPTNO is the PRIMARY KEY. 

In the EMP table, EMPNO is the PRIMARY KEY and DEPTNO is the FOREIGN KEY referencing 

the DEPTNO column in the DEPT table. 

What would be the outcome of the following statements executed in the given sequence? 

DROP TABLE emp; 

FLASHBACK TABLE emp TO BEFORE DROP; 

INSERT INTO emp VALUES (2.COTT 10); 

INSERT INTO emp VALUES (3,ING 55); 

A. Both the INSERT statements would fail because all constraints are automatically retrieved when the table is flashed back. 

B. Both the INSERT statements would succeed because none of the constraints on the table are automatically retrieved when the table is flashed back. 

C. Only the first INSERT statement would succeed because all the constraints except the primary key constraint are automatically retrieved after a table is flashed back. 

D. Only the second INSERT statement would succeed because all the constraints except referential integrity constraints that reference other tables are retrieved automatically after the table is flashed back. 

Answer: D