1z0-047 Premium Bundle

1z0-047 Premium Bundle

Oracle Database SQL Expert Certification Exam

4.5 
(5715 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
November 21, 2024Last update

Oracle 1z0-047 Free Practice Questions

Q1. View the Exhibit and examine the description of the DEPARTMENTS and EMPLOYEES tables. 

To retrieve data for all the employees for their EMPLOYEE_ID, FIRST_NAME, and DEPARTMENT NAME, the following SQL statement was written: 

SELECT employee_id, first_name, department_name 

FROM employees NATURAL JOIN departments; 

The desired output is not obtained after executing the above SQL statement. What could be the reason for this? 

A. The NATURAL JOIN clause is missing the USING clause. 

B. The table prefix is missing for the column names in the SELECT clause. 

C. The DEPARTMENTS table is not used before the EMPLOYEES table in the FROM clause. 

D. The EMPLOYEES and DEPARTMENTS tables have more than one column with the same column name and data type. 

Answer: D

Q2. View the Exhibit and examine the description of the EMPLOYEES and DEPARTMENTS tables. 

You want to display the LAST_NAME for the employees, LAST_NAME for the manager of the employees, and the DEPARTMENT_NAME for the employees having 100 as MANAGER_ID. The following SQL statement was written: 

SELECT m.last_name "Manager", e.last_name "Employee", department_name "Department" FROM employees m JOIN employees e 

ON (m.employee_id = e.manager_id) 

WHERE e.manager_id=100 

JOIN departments d 

ON (e.department_id = d.department_id); 

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

A. The statementwouldprovide the desired results. 

B. Thestatement wouldnotexecute because the ON clause iswritten twice. 

C. Thestatement wouldnot execute because the WHERE clause is wrongly placed. 

D. The statement wouldnot execute because the self join usestheON clauseinsteadof the USING clause. 

Answer: C

Q3. Which two statements are true regarding the EXISTS operator used in the correlated subqueries? (Choose two.) 

A. The outer query stops evaluating the result set of the inner query when the first value is found. 

B. It is used to test whether the values retrieved by the inner query exist in the result of the outer query. 

C. It is used to test whether the values retrieved by the outer query exist in the result set of the inner query. 

D. The outer query continues evaluating the result set of the inner query until all the values in the result set are processed. 

Answer: AC

Q4. Which two statements are true regarding the GROUP BY clause in a SQL statement? (Choose two.) 

A. You can use column alias in the GROUP BY clause. 

B. Using the WHERE clause after the GROUP BY clause excludes the rows after creating groups. 

C. The GROUP BY clause is mandatory if you are using an aggregate function in the SELECT clause. 

D. Using the WHERE clause before the GROUP BY clause excludes the rows before creating groups. 

E. If the SELECT clause has an aggregate function, then those individual columns without an aggregate function in the SELECT clause should be included in the GROUP BY clause. 

Answer: DE

Q5. View the Exhibit and examine the description of the EMPLOYEES table. 

Your company wants to give 5% bonus to all the employees on their annual salary. The SALARY column stores the monthly salary for an employee. To check the total for annual salary and bonus amount for each employee, you issued the following SQL statement: 

SELECTfirst_name, salary, salary*!2+salary*12*.05 "ANNUAL SALARY + BONUS" FROM employees; 

Which statement is true regarding the above query? 

A. It would execute and give you the desired output. 

B. It would not execute because the AS keyword is missing between the column name and the alias. 

C. It would not execute because double quotation marks are used instead of single quotation marks for assigning alias for the third column. 

D. It would execute but the result for the third column would be inaccurate because the parentheses for overriding the precedence of the operator are missing. 

Answer: A

Q6. Which three tasks can be performed using regular expression support in Oracle Database 10g? (Choose three.) 

A. it can be used to concatenate two strings. 

B. it can be used to find out the total length of the string. 

C. it can be used for string manipulation and searching operations. 

D. it can be used to format the output for a column or expression having string data. 

E. it can be used to find and replace operations for a column or expression having string data. 

Answer: CDE

Q7. View the Exhibit and examine the details of the EMPLOYEES table. 

Evaluate the following SQL statement: 

SELECT phone_number, 

REGEXP_REPLACE(phone_number,'([[: digit: ]]{3})\.([[: digit: ]]{3})\.([[: digit: ]]{4})', ,(\1)\2-\3') 

"PHONE NUMBER" 

FROM employees; 

The query was written to format the PHONE_NUMBER for the employees. Which option would be the correct format in the output? 

A. xxx-xxx-xxxx 

B. (xxx) xxxxxxx 

C. (xxx) xxx-xxxx 

D. xxx-(xxx)-xxxx 

Answer: C

Q8. View the Exhibit and examine PRODUCTS and ORDER_ITEMS tables. 

You executed the following query to display PRODUCT_NAME and the number of times the product has been ordered: 

SELECT p.product_name, i.item_cnt 

FROM (SELECT product_id, COUNT (*) item_cnt 

FROM order_items 

GROUP BY product_id) i RIGHT OUTER JOIN products p 

ON i.product_id = p.product_id; 

What would happen when the above statement is executed? 

A. The statement would execute successfully to produce the required output. 

B. The statement would not execute because inline views and outer joins cannot be used together. 

C. The statement would not execute because the ITEM_CNT alias cannot be displayed in the outer query. 

D. The statement would not execute because the GROUP BY clause cannot be used in the inline view. 

Answer: A

Q9. 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

Q10. Evaluate the following SQL statements that are issued in the given order: 

CREATE TABLE emp 

(emp_no NUMBER(2) CONSTRAINT emp_emp_no_pk PRIMARY KEY, 

enameVARCHAR2(15), 

salary NUMBER(8,2), 

mgr_no NUMBER(2) CONSTRAINT emp_mgr_fk REFERENCES emp); 

ALTER TABLE emp 

DISABLE CONSTRAINT emp_emp_no_pk CASCADE; 

ALTER TABLE emp 

ENABLE CONSTRAINT emp_emp_no_pk; 

What would be the status of the foreign key EMP_MGR_FK? 

A. It would be automatically enabled and deferred. 

B. It would be automatically enabled and immediate. 

C. It would remain disabled and has to be enabled manually using the ALTER TABLE command. 

D. It would remain disabled and can be enabled only by dropping the foreign key constraint and re-creating it. 

Answer: C

Q11. View the Exhibit and examine the description of the CUSTOMERS table. 

You want to add a constraint on the CUST_FIRST_NAME column of the CUSTOMERS table so that the value inserted in the column does not have numbers. 

Which SOL statement would you use to accomplish the task? 

A. ALTER TABLE CUSTOMERS 

ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name1'^A-Z’))NOVALIDATE; 

B. ALTER TABLE CUSTOMERS

 ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'^[0-9]’))NOVALIDATE; 

C. ALTER TABLE CUSTOMERS

 ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:alpha: ]]’))NOVALIDATE; 

D. ALTER TABLE CUSTOMERS 

ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:digit: ]]’))NOVALIDATE ; 

Answer: C

Q12. 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

Q13. 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

Q14. Which three tasks can be performed using regular expression support in Oracle Database 10g? (Choose three.) 

A. it can be used to concatenate two strings. 

B. it can be used to find out the total length of the string. 

C. it can be used for string manipulation and searching operations. 

D. it can be used to format the output for a column or expression having string data. 

E. it can be used to find and replace operations for a column or expression having string data. 

Answer: CDE

Q15. View the Exhibit and examine the description of the ORDERS table. 

Evaluate the following SQL statement: 

SELECT order_id, customer_id 

FROM orders 

WHERE order_date > 'June 30 2001' 

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

A. It would not execute because 'June 30 2001' in the WHERE condition is not enclosed within double quotation marks. 

B. It would execute and would return ORDER_ID and CUSTOMER_ID for all records having ORDER_DATE greater than 'June 30 2001'. 

C. It would not execute because 'June 30 2001' in the WHERE condition cannot be converted implicitly and needs the use of the TO_DATE conversion function for proper execution. 

D. It would not execute because 'June 30 2001' in the WHERE condition cannot be converted implicitly and needs the use of the TO_CHAR conversion function for proper execution. 

Answer: C

START 1z0-047 EXAM