1z0-047 Premium Bundle

1z0-047 Premium Bundle

Oracle Database SQL Expert Certification Exam

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

Oracle 1z0-047 Free Practice Questions

Q1. Evaluate the following statements: 

CREATE TABLE digits 

(id NUMBER(2), 

description VARCHAR2(15)); 

INSERT INTO digits VALUES (1,'ONE); 

UPDATE digits SET description =’TWO'WHERE id=1; 

INSERT INTO digits VALUES (2 .’TWO’); 

COMMIT; 

DELETE FROM digits; 

SELECT description FROM digits 

VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE; 

What would be the outcome of the above query? 

A. Itwouldnot display any values. 

B. It would displaythevalue TWO once. 

C. Itwould display the valueTWOtwice. 

D. Itwould display the values ONE, TWO, andTWO. 

Answer: C

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

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

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 areevaluatedby allthe three WHENclauses regardlessofthe resultsof the evaluation ofany other WHEN clause. 

B. They are evaluated by thefirst WHENclause. 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 isfalse,thenthe row wouldbeevaluated by the subsequentWHENclauses. 

D. TheINSERT statement would give an error becausetheELSE clause is notpresent forsupport in case none of theWHENclauses are true. 

Answer: A

Q5. View the Exhibit and examine the descriptions of ORDER_ITEMS and ORDERS tables. 

You want to display the CUSTOMER_ID, PRODUCT_ID, and total (UNIT_PRICE multiplied by QUANTITY) for the order placed. You also want to display the subtotals for a CUSTOMER_ID as well as for a PRODUCT ID for the last six months. 

A. SELECT o.customer_Id, oi.productj_id, SUM(oi.unit_price*oi. quantity) "Total" 

FROM order_items oi JOIN orders o 

ON oi.order_id=o.order_id 

GROUP BY ROLLUP (o.customer_id.oi.product_id) 

WHERE MONTHS_BETWEEN(order_date, SYSDATE) <= 6; 

B. SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi. quantity) "Total" 

FROM orderjtems oi JOIN orders o 

ON oi.order_id=o.order_id 

GROUP BY ROLLUP (o.customer_id.oi.product_id) 

HAVING MONTHS_BETWEEN(order_date, SYSDATE) <= 6; 

C. SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" 

FROM order_items oi JOIN orders o 

ON oi.order_id=o.order_id 

GROUP BY ROLLUP (o.customer_id, oi.product_id) 

WHERE MONTHS_BETWEEN(order_date, SYSDATE) >= 6; 

D. SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" 

FROM order_items oi JOIN orders o 

ON oi.order_id=o.order_id 

WHERE MONTHS_BETWEEN(order_date, SYSDATE) <= 6 

GROUP BY ROLLUP (o.customer_id, oi.product_id); 

Answer: D

Q6. View the Exhibit and examine the table structure of DEPARTMENTS and LOCATIONS tables. 

You want to display all the cities that have no departments and the departments that have not been allocated cities. 

Which type of join between DEPARTMENTS and LOCATIONS tables would produce this information as part of its output? 

A. NATURAL JOIN 

B. FULL OUTERJOIN 

C. LEFT OUTERJOIN 

D. RIGHT OUTER JOIN 

Answer: B

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

Q8. You need to load information about new customers from the NEW_CUST table into the tables CUST and CUST_SPECIAL If a new customer has a credit limit greater than 10,000, then the details have to be inserted into CUST_SPECIAL All new customer details have to be inserted into the CUST table. Which technique should be used to load the data most efficiently? 

A. external table 

B. the MERGEcommand 

C. themultitableINSERT command 

D. INSERTusingWITHCHECK OPTION 

Answer: C

Q9. View the Exhibit and examine the structure of the EMPLOYEES table. 

You want to know the FIRST_NAME and SALARY for all employees who have the same manager as that of the employee with the first name 'Neena' and have salary equal to or greater than that of'Neena'. 

Which SQL statement would give you the desired result? 

A. SELECTfirst_name, salary FROM employees WHERE (manager_id, salary) >= ALL (SELECT manager_id, salary FROM employees WHERE first_name = 'Neena' AND first_name <> 'Neena' 

B. SELECT first_name, salary FROM employees WHERE (manager_id, salary) >= (SELECT manager_id, salary FROM employees WHERE first_name = 'Neena') AND first_name <> 'Neena' 

C. SELECT first_name, salary FROM employees WHERE (manager_id, salary) >= ANY (SELECT manager_id, salary FROM employees WHERE first_name = 'Neena' AND first_name <> 'Neena' 

D. SELECT first_name, salaryFROM employees WHERE (manager_id = (SELECT manager_id FROM employees WHERE first_name = 'Neena') AND salary >= (SELECT salary FROM employees WHERE first_name = 'Neena')) AND first name <> 'Neena' 

Answer: D

Q10. Evaluate the CREATE TABLE statement: 

CREATE TABLE products 

(product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY, 

product_name VARCHAR2(15)); 

Which statement is true regarding the PROD_ID_PK constraint? 

A. Itwould becreated only if a unique index is manually created first. 

B. Itwould becreated andwould use an automatically created unique index. 

C. It would be createdandwould use an automaticallycreatednonunique index. 

D. Itwouldbecreated and remainsinadisabledstatebecauseno indexis specified in the command. 

Answer: B

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

Evaluate the following SQL statement: 

SELECT employee_id, last_name, job_id, manager_id, LEVEL 

FROM employees 

START WITH employee_id = 101 

CONNECT BY PRIOR employee_id=manager_id ; 

Which two statements are true regarding the output of this command? (Choose two.) 

A. Theoutputwouldbeintop-downhierarchy starting with EMPLOYEE_ID having value 101. 

B. Theoutput wouldbein bottom-up hierarchystartingwith EMPLOYEE_ID havingvalue101. 

C. TheLEVEL columndisplaysthenumber of employees in the hierarchy under the employee having theEMPLOYEE_ID 101. 

D. The LEVEL column displays the level in the hierarchy at which the employee is placed undertheemployee having the EMPLOYEE_ID 101 

Answer: BC

Q12. View the Exhibit and examine the description for EMPLOYEES and DEPARTMENTS tables. 

Evaluate the following SQL statement: 

SELECT e.department_id, e.job_id, d.location_id, sum(e. salary) total FROM employees e JOIN departments d ON e.department_id = d.department_id GROUP BY CUBE (e.department_id, e.job_id, d.location_id); 

Which two statements are true regarding the output of this command? (Choose two.) 

A. Theoutputwould display thetotal salaryforallthedepartments. 

B. Theoutputwoulddisplay the total salaryforall theJOB_IDsinadepartment. 

C. The output would display only the grand total ofthesalary for allJOB_IDsin a LOCATION_ID. 

D. Theoutput would displaythegrandtotalof thesalaryfor only the groups specified in the GROUP BY clause. 

Answer: AB

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

You want to display the EMPLOYEE_ID, LAST_NAME, and SALARY for the employees who get 

the maximum salary in their respective departments. The following SQL statement was written: 

WITH 

SELECT employee_id, last_name, salary 

FROM employees 

WHERE (department_id, salary) = ANY (SELECT* 

FROM dept_max) 

dept_max as (SELECT d.department_id, max(salary) 

FROM departments d JOIN employees j 

ON (d. department_id = j. department_id) 

GROUP BY d. department_id); 

Which statement is true regarding the execution and the output of this statement? 

A. The statement would execute and give the desired results. 

B. The statement would not execute because the = ANY comparison operator is used instead of=. 

C. The statement would not execute because the main query block uses the query name before it is even created. 

D. The statement would not execute because the comma is missing between the main query block and the query name. 

Answer: C

Q14. Evaluate the SQL statements: 

CREATE TABLE new_order 

(orderno NUMBER(4), 

booking_date TIMESTAMP WITH LOCAL TIME ZONE); 

The database is located in San Francisco where the time zone is -8:00. 

The user is located in New York where the time zone is -5:00. 

A New York user inserts the following record: 

INSERT INTO new_order 

VALUES(1, TIMESTAMP 007-05-10 6:00:00 -5:00"); 

Which statement is true? 

A. When theNewYorkuserselects the row, booking_date is displayed as 007-05-10 3.00.00.000000' 

B. When the New York user selectstherow, booking_date is displayed as 2007-05-10 6.00.00.000000 -5:00'. 

C. WhentheSan Francisco user selectstherow, booking_date is displayed as 007-05-103.00.00.000000' 

D. When the San Francisco user selectstherow,booking_dateis displayed 

as 007-05-103.00.00.000000-8:00' 

Answer: C

Q15. Given below is the list of meta character syntaxes and their descriptions in random order: Meta character syntax Description 1) ^a) Matches character not in the list 

2) [^...] b) Matches character when it occurs at the beginning of a line 3) | c) Treats the subsequent meta character as a literal 4) \ d) Matches one of the characters such as the OR operator Identify the option that correctly matches the meta character syntaxes with their descriptions. 

A. 1-b,2-a,3-d.4-c 

B. 1-a, 2-b,3-d.4-c 

C. 1-d, 2-b,3-a.4-c 

D. 1-b,2-c,3-d,2-a 

Answer: A

START 1z0-047 EXAM