Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:       Oracle Database SQL ExpertExam Type        OracleExam Code:       1Z0-047                                ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:       Oracle Database SQL ExpertExam Type        OracleExam Code:       1Z0-047                                ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:        Oracle Database SQL ExpertExam Type         OracleExam Code:        1Z0-047                             ...
Exam Name:           Oracle Database SQL ExpertExam Type            OracleExam Code:           1Z0-047                    ...
Exam Name:           Oracle Database SQL ExpertExam Type            OracleExam Code:           1Z0-047                    ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
Exam Name:          Oracle Database SQL ExpertExam Type           OracleExam Code:          1Z0-047                       ...
Exam Name:         Oracle Database SQL ExpertExam Type          OracleExam Code:         1Z0-047                          ...
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
1 z0 047
Upcoming SlideShare
Loading in...5
×

1 z0 047

3,346

Published on

1 z0 047

Published in: Education, Technology

1 z0 047

  1. 1. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Question: 1You need to load information about new customers from the NEW_CUST table into the tablesCUST and CUST_SPECIAL. If a new customer has a credit limit greater than 10,000, then thedetails have to be inserted into CUST_SPECIAL. All new customer details have to be insertedinto the CUST table. Which technique should be used to load the data most efficiently?A. external tableB. the MERGE commandC. the multitable INSERT commandD. INSERT using WITH CHECK OPTIONAnswer: CQuestion: 2View 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 sothat the value inserted in the column does not have numbers.Which SQL statement would you use to accomplish the task?A. ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,^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: CQuestion: 3Which three tasks can be performed using regular expression support in Oracle Database 10g?(Choose three.)Page 1 of 91
  2. 2. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. 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: C, D, EQuestion: 4View the Exhibit and examine the structure of the EMP table which is not partitioned and not anindex-organized table.Evaluate the following SQL statement:ALTER TABLE empDROP COLUMN first_name;Which two statements is true regarding the above command? (Choose two.)A. The FIRST_NAME column would be dropped provided it does not contain any data.B. The FIRST_NAME column would be dropped provided at least one or more columns remain in the table.C. The FIRST_NAME column can be rolled back provided the SET UNUSED option is added to the above SQL statement.D. The FIRST_NAME column can be dropped even if it is part of a composite PRIMARY KEY provided the CASCADE option is used.Answer: B, DQuestion: 5Evaluate 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. It would be created only if a unique index is manually created first.B. It would be created and would use an automatically created unique index.C. It would be created and would use an automatically created no unique index.D. It would be created and remains in a disabled state because no index is specified in the command.Answer: BQuestion: 6Page 2 of 91
  3. 3. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Which two statements are true? (Choose two.)A. The USER_SYNONYMS view can provide information about private synonyms.B. The user SYSTEM owns all the base tables and user-accessible views of the data dictionary.C. All the dynamic performance views prefixed with V$ are accessible to all the database users.D. The USER_OBJECTS view can provide information about the tables and views created by the user only.E. DICTIONARY is a view that contains the names of all the data dictionary views that the user can access.Answer: A, EQuestion: 7View the Exhibit and examine the description of the ORDERS table.Which two WHERE clause conditions demonstrate the correct usage of conversion functions?(Choose two.)A. WHERE order_date > TO_DATE(JUL 10 2006,MON DD YYYY)B. WHERE TO_CHAR(order_date,MON DD YYYY) = JAN 20 2003C. WHERE order_date > TO_CHAR(ADD_MONTHS(SYSDATE,6),MON DD YYYY)D. WHERE order_date IN ( TO_DATE(Oct 21 2003,Mon DD YYYY), TO_CHAR(NOV 21 2003,Mon DD YYYY) )Answer: A, BQuestion: 8View the Exhibit and examine the description of the EMPLOYEES table.Page 3 of 91
  4. 4. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Your company decided to give a monthly bonus of $50 to all the employees who have completedfive years in the company. The following statement is written to display the LAST_NAME,DEPARTMENT_ID, and the total annual salary:SELECT last_name, department_id, salary+50*12 "Annual Compensation"FROM employeesWHERE MONTHS_BETWEEN(SYSDATE, hire_date)/12 >= 5;When you execute the statement, the "Annual Compensation" is not computed correctly. Whatchanges would you make to the query to calculate the annual compensation correctly?A. Change the SELECT clause to SELECT last_name, department_id, salary*12+50 "Annual Compensation".B. Change the SELECT clause to SELECT last_name, department_id, salary+(50*12) "Annual Compensation".C. Change the SELECT clause to SELECT last_name, department_id, (salary+50)*12 "Annual Compensation".D. Change the SELECT clause to SELECT last_name, department_id, (salary*12)+50 "Annual Compensation".Answer: CQuestion: 9Evaluate the following CREATE SEQUENCE statement:CREATE SEQUENCE seq1START WITH 100INCREMENT BY 10MAXVALUE 200CYCLENOCACHE;The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue thefollowing SQL statement:SELECT seq1.nextval FROM dual;What is displayed by the SELECT statement?A. 1B. 10C. 100D. an errorPage 4 of 91
  5. 5. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Answer: AQuestion: 10View the Exhibit and examine the description of the EMPLOYEES table.You want to display the EMPLOYEE_ID, FIRST_NAME, and DEPARTMENT_ID for all theemployees who work in the same department and have the same manager as that of theemployee having EMPLOYEE_ID 104. To accomplish the task, you execute the following SQLstatement:SELECT employee_id, first_name, department_idFROM employeesWHERE (manager_id, department_id) =(SELECT department_id, manager_idFROM employeesWHERE employee_id = 104)AND employee_id <> 104;When you execute the statement it does not produce the desired output. What is the reason forthis?A. The WHERE clause condition in the main query is using the = comparison operator, instead of EXISTS.B. The WHERE clause condition in the main query is using the = comparison operator, instead of the IN operator.C. The WHERE clause condition in the main query is using the = comparison operator, instead of the = ANY operator.D. The columns in the WHERE clause condition of the main query and the columns selected in the subquery should be in the same order.Answer: DQuestion: 11View the Exhibit and examine the descriptions of ORDER_ITEMS and ORDERS tables.Page 5 of 91
  6. 6. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You want to display the CUSTOMER_ID, PRODUCT_ID, and total (UNIT_PRICE multiplied byQUANTITY) for the order placed. You also want to display the subtotals for a CUSTOMER_ID aswell as for a PRODUCT_ID for the last six months.Which SQL statement would you execute to get the desired output?A. 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;B. 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) 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: DQuestion: 12View the Exhibit and examine the structure of the EMPLOYEES table.Page 6 of 91
  7. 7. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You want to retrieve hierarchical data of the employees using the top-down hierarchy. Which SQLclause would let you choose the direction to walk through the hierarchy tree?A. WHEREB. HAVINGC. GROUP BYD. START WITHE. CONNECT BY PRIORAnswer: EQuestion: 13Which two statements is true regarding the execution of the correlated subqueries? (Choosetwo.)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: A, DQuestion: 14OE and SCOTT are the users in the database. The ORDERS table is owned by OE. Evaluate thestatements issued by the DBA in the following sequence:CREATE ROLE r1;GRANT SELECT, INSERT ON oe.orders TO r1;GRANT r1 TO scott;GRANT SELECT ON oe.orders TO scott;REVOKE SELECT ON oe.orders FROM scott;What would be the outcome after executing the statements?A. SCOTT would be able to query the OE.ORDERS table.B. SCOTT would not be able to query the OE.ORDERS table.C. The REVOKE statement would remove the SELECT privilege from SCOTT as well as from the role R1.Page 7 of 91
  8. 8. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168D. The REVOKE statement would give an error because the SELECT privilege has been granted to the role R1.Answer: AQuestion: 15Evaluate the following SQL statement:ALTER TABLE hr.empSET UNUSED (mgr_id);Which statement is true regarding the effect of the above SQL statement?A. Any synonym existing on the EMP table would have to be re-created.B. Any constraints defined on the MGR_ID column would be removed by the above command.C. Any views created on the EMP table that include the MGR_ID column would have to be dropped and re-created.D. Any index created on the MGR_ID column would continue to exist until the DROP UNUSED COLUMNS command is executed.Answer: BQuestion: 16EMPDET is an external table containing the columns EMPNO and ENAME.Which command would work in relation to the EMPDET table?A. UPDATE empdet SET ename = Amit WHERE empno = 1234;B. DELETE FROM empdet WHERE ename LIKE J%;C. CREATE VIEW empvu AS SELECT * FROM empdept;D. CREATE INDEX empdet_idx ON empdet(empno);Answer: CQuestion: 17View the Exhibit and examine the structure of the MARKS_DETAILS and MARKStables.Page 8 of 91
  9. 9. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Which is the best method to load data from the MARKS_DETAILStable to the MARKStable?A. Pivoting INSERTB. Unconditional INSERTC. Conditional ALL INSERTD. Conditional FIRST INSERTAnswer: AQuestion: 18View the Exhibit and examine the data in ORDERS and ORDER_ITEMS tables.Page 9 of 91
  10. 10. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You need to create a view that displays the ORDER ID, ORDER_DATE, and the total number ofitems in each order.Which CREATE VIEW statement would create the view successfully?A. CREATE OR REPLACE VIEW ord_vu (order_id,order_date) AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id) "NO OF ITEMS" FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date;B. CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id) "NO OF ITEMS" FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date;C. CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id) FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date;D. CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id)|| NO OF ITEMS FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date WITH CHECK OPTION;Answer: BQuestion: 19View the Exhibit and examine PRODUCTS and ORDER_ITEMS tables.Page 10 of 91
  11. 11. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You executed the following query to display PRODUCT_NAME and the number of times theproduct has been ordered:SELECT p.product_name, i.item_cntFROM (SELECT product_id, COUNT (*) item_cntFROM order_itemsGROUP BY product_id) i RIGHT OUTER JOIN products pON 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: AQuestion: 20In which scenario would you use the ROLLUP operator for expression or columns within aGROUP BY clause?A. to find the groups forming the subtotal in a rowB. to create group-wise grand totals for the groups specified within a GROUP BY clauseC. to create a grouping for expressions or columns specified within a GROUP BY clause in one direction, from right to left for calculating the subtotalsD. to create a grouping for expressions or columns specified within a GROUP BY clause in all possible directions, which is cross-tabular report for calculating the subtotalsAnswer: CQuestion: 21View the Exhibit and examine the details of the EMPLOYEES table.Page 11 of 91
  12. 12. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Evaluate 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 wouldbe the correct format in the output?A. xxx-xxx-xxxxB. (xxx) xxxxxxxC. (xxx) xxx-xxxxD. xxx-(xxx)-xxxxAnswer: CQuestion: 22Which statement correctly grants a system privilege?A. GRANT EXECUTE ON proc1 TO PUBLIC;B. GRANT CREATE VIEW ON table1 TO user1;C. GRANT CREATE TABLE TO user1,user2;D. GRANT CREATE SESSION TO ALL;Answer: CQuestion: 23View the Exhibit and examine the structure of the CUST table.Page 12 of 91
  13. 13. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Evaluate the following SQL statements executed in the given order:ALTER TABLE custADD CONSTRAINT cust_id_pk PRIMARY KEY(cust_id) DEFERRABLE INITIALLY DEFERRED;INSERT INTO cust VALUES (1,RAJ); --row 1INSERT INTO cust VALUES (1,SAM); --row 2COMMIT;SET CONSTRAINT cust_id_pk IMMEDIATE;INSERT INTO cust VALUES (1,LATA); --row 3INSERT INTO cust VALUES (2,KING); --row 4COMMIT;Which rows would be made permanent in the CUST table?A. row 4 onlyB. rows 2 and 4C. rows 3 and 4D. rows 1 and 4Answer: CQuestion: 24View the Exhibit and examine the structure of the ORDERS table:The ORDER_ID column has the PRIMARY KEY constraint and CUSTOMER_ID has the NOTNULL constraint.Evaluate the following statement:INSERT INTO (SELECT order_id,order_date,customer_idFROM ORDERSWHERE order_total = 1000WITH CHECK OPTION)VALUES (13, SYSDATE, 101);What would be the outcome of the above INSERT statement?A. It would execute successfully and the new row would be inserted into a new temporary table created by the subquery.B. It would execute successfully and the ORDER_TOTAL column would have the value 1000 inserted automatically in the new row.C. It would not execute successfully because the ORDER_TOTAL column is not specified in the SELECT list and no value is provided for it.Page 13 of 91
  14. 14. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168D. It would not execute successfully because all the columns from the ORDERS table should have been included in the SELECT list and values should have been provided for all the columns.Answer: CQuestion: 25View 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 SALARYcolumn stores the monthly salary for an employee. To check the total for annual salary and bonusamount for each employee, you issued the following SQL statement:SELECT first_name, salary, salary*12+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: AQuestion: 26Which statement is true regarding external tables?A. The default REJECT LIMIT for external tables is UNLIMITED.B. The data and metadata for an external table are stored outside the database.C. ORACLE_LOADER and ORACLE_DATAPUMP have exactly the same functionality when used with an external table.D. The CREATE TABLE AS SELECT statement can be used to unload data into regular table in the database from an external table.Answer: DQuestion: 27Page 14 of 91
  15. 15. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168View the Exhibit and examine the structure of the PRODUCT_INFORMATION table.You want to see the product names and the date of expiration of warranty for all the products, ifthe product is purchased today. The products that have no warranty should be displayed at thetop and the products with maximum warranty period should be displayed at the bottom.Which SQL statement would you execute to fulfill this requirement?A. SELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date" FROM product_information ORDER BY SYSDATE-warranty_period;B. SELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date" FROM product_information ORDER BY SYSDATE+warranty_period;C. SELECT product_name, category_id, SYSDATE+warranty_period AS "Warranty expire date" FROM product_information ORDER BY SYSDATE;D. SELECT product_name, category_id, SYSDATE+warranty_period "Warranty expire date" FROM product_information WHERE warranty_period >SYSDATE;Answer: BQuestion: 28Which 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: A, CQuestion: 29Page 15 of 91
  16. 16. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A non-correlated subquery can be defined as ____.A. a set of sequential queries, all of which must always return a single valueB. a set of sequential queries, all of which must return values from the same tableC. a SELECT statement that can be embedded in a clause of another SELECT statement onlyD. a set of one or more sequential queries in which generally the result of the inner query is used as the search value in the outer queryAnswer: DQuestion: 30You need to create a table for a banking application with the following considerations:1) You want a column in the table to store the duration of the credit period.2) The data in the column should be stored in a format such that it can be easily added and subtracted with3) date type data without using the conversion functions.4) The maximum period of the credit provision in the application is 30 days.5) The interest has to be calculated for the number of days an individual has taken a credit for.Which data type would you use for such a column in the table?A. INTERVAL YEAR TO MONTHB. INTERVAL DAY TO SECONDC. TIMESTAMP WITH TIME ZONED. TIMESTAMP WITH LOCAL TIME ZONEAnswer: BQuestion: 31Which statements are true regarding the hierarchical query in Oracle Database 10g? (Choose allthat apply.)A. It is possible to retrieve data only in top-down hierarchy.B. It is possible to retrieve data in top-down or bottom-up hierarchy.C. It is possible to remove an entire branch from the output of the hierarchical query.D. You cannot specify conditions when you retrieve data by using a hierarchical query.Answer: B, CQuestion: 32Which two statements are true regarding views? (Choose two.)A. A simple view in which column aliases have been used cannot be updated.B. A subquery used in a complex view definition cannot contain group functions or joins.C. Rows cannot be deleted through a view if the view definition contains the DISTINCT keyword.D. Rows added through a view are deleted from the table automatically when the view is dropped.E. The OR REPLACE option is used to change the definition of an existing view without dropping and re-creating it.F. The WITH CHECK OPTION constraint can be used in a view definition to restrict the columns displayed through the view.Answer: C, EPage 16 of 91
  17. 17. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Question: 33View the Exhibit and examine the details of the ORDER_ITEMS table.Evaluate the following SQL statements:Statement 1:SELECT MAX(unit_price*quantity) "Maximum Order"FROM order_items;Statement 2:SELECT MAX(unit_price*quantity) "Maximum Order"FROM order_itemsGROUP BY order_id;Which statements are true regarding the output of these SQL statements? (Choose all thatapply.)A. Statement 1 would return only one row of output.B. Both the statements would give the same output.C. Statement 2 would return multiple rows of output.D. Statement 1 would not return any row because the GROUP BY clause is missing.E. Both statements would ignore NULL values for the UNIT_PRICE and QUANTITY columns.Answer: A, C, EQuestion: 34View the Exhibit and examine the structure of the ORDERS and ORDER_ITEMS tables.Page 17 of 91
  18. 18. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Evaluate the following SQL statement:SELECT oi.order_id, product_id, order_dateFROM order_items oi JOIN orders oUSING(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: DQuestion: 35Evaluate the following SQL statements in the given order:DROP TABLE dept;CREATE TABLE dept(deptno NUMBER(3) PRIMARY KEY,deptname VARCHAR2(10));DROP TABLE dept;FLASHBACK TABLE dept TO BEFORE DROP;Which statement is true regarding the above FLASHBACK operation?A. It recovers only the first DEPT table.B. It recovers only the second DEPT table.C. It does not recover any of the tables because FLASHBACK is not possible in this case.D. It recovers both the tables but the names would be changed to the ones assigned in the RECYCLEBIN.Page 18 of 91
  19. 19. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Answer: BQuestion: 36Evaluate 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 digitsVERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE;What would be the outcome of the above query?A. It would not display any values.B. It would display the value TWO once.C. It would display the value TWO twice.D. It would display the values ONE, TWO, and TWO.Answer: CQuestion: 37View the Exhibit and examine the description of the ORDERS table.Evaluate the following SQL statement:SELECT order_id, customer_idFROM ordersWHERE order_date > June 30 2001;Which statement is true regarding the execution of this SQL statement?Page 19 of 91
  20. 20. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. 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: CQuestion: 38Which statements are correct regarding indexes? (Choose all that apply.)A. When a table is dropped, the corresponding indexes are automatically dropped.B. For each DML operation performed, the corresponding indexes are automatically updated.C. Indexes should be created on columns that are frequently referenced as part of an expression.D. A non-deferrable PRIMARY KEY or UNIQUE KEY constraint in a table automatically creates a unique index.Answer: A, B, DQuestion: 39View the Exhibit and examine the description of the PRODUCT_INFORMATION table.Which SQL statement would retrieve from the table the number of products having LIST_PRICEas NULL?A. SELECT COUNT(list_price) FROM product_information WHERE list_price IS NULL;B. SELECT COUNT(list_price) FROM product_informationPage 20 of 91
  21. 21. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168 WHERE list_price = NULL;C. SELECT COUNT(NVL(list_price, 0)) FROM product_information WHERE list_price IS NULL;D. SELECT COUNT(DISTINCT list_price) FROM product_information WHERE list_price IS NULL;Answer: CQuestion: 40User OE, the owner of the ORDERS table, issues the following command:GRANT SELECT ,INSERTON ordersTO hrWITH GRANT OPTION;The user HR issues the following command:GRANT SELECTON oe.ordersTO scott;Then, OE issues the following command:REVOKE ALLON ordersFROM hr;Which statement is correct?A. The user SCOTT loses the privilege to select rows from OE.ORDERS.B. The user SCOTT retains the privilege to select rows from OE.ORDERS.C. The REVOKE statement generates an error because OE has to first revoke the SELECT privilege from SCOTT.D. The REVOKE statement generates an error because the ALL keyword cannot be used for privileges that have been granted using WITH GRANT OPTION.Answer: AQuestion: 41View the Exhibit and examine the structure of the EMP table.You executed the following command to add a primary key to the EMP table:ALTER TABLE empADD CONSTRAINT emp_id_pk PRIMARY KEY (emp_id)USING INDEX emp_id_idx;Which statement is true regarding the effect of the command?A. The PRIMARY KEY is created along with a new index.B. The PRIMARY KEY is created and it would use an existing unique index.C. The PRIMARY KEY would be created in a disabled state because it is using an existing index.Page 21 of 91
  22. 22. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168D. The statement produces an error because the USING clause is permitted only in the CREATE TABLE command.Answer: BQuestion: 42SCOTT is a user in the database.Evaluate the commands issued by the DBA:1 - CREATE ROLE mgr;2 - GRANT CREATE TABLE, SELECT ON oe.orders TO mgr;3 - GRANT mgr, create table TO SCOTT;Which statement is true regarding the execution of the above commands?A. Statement 1 would not execute because the WITH GRANT option is missing.B. Statement 1 would not execute because the IDENTIFIED BY <password> clause is missing.C. Statement 3 would not execute because role and system privileges cannot be granted together in a single GRANT statement.D. Statement 2 would not execute because system privileges and object privileges cannot be granted together in a single GRANT command.Answer: DQuestion: 43Which statement best describes the GROUPING function?A. It is used to set the order for the groups to be used for calculating the grand totals and subtotals.B. It is used to form various groups to calculate total and subtotals created using ROLLUP and CUBE operators.C. It is used to identify if the NULL value in an expression is a stored NULL value or created by ROLLUP or CUBE.D. It is used to specify the concatenated group expressions to be used for calculating the grand totals and subtotals.Answer: CQuestion: 44View the Exhibit and examine the structure of ORD and ORD_ITEMS tables.Page 22 of 91
  23. 23. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168In the ORD table, the PRIMARY KEY is ORD_NO and in the ORD_ITEMS tables the compositePRIMARY KEY is (ORD_NO, ITEM_NO).Which two CREATE INDEX statements are valid? (Choose two.)A. CREATE INDEX ord_idx ON ord(ord_no);B. CREATE INDEX ord_idx ON ord_items(ord_no);C. CREATE INDEX ord_idx ON ord_items(item_no);D. CREATE INDEX ord_idx ON ord,ord_items(ord_no, ord_date,qty);Answer: B, CQuestion: 45View the Exhibit and examine the structure of the CUSTOMERS table.CUSTOMER_VU is a view based on CUSTOMERS_BR1 table which has the same structure asCUSTOMERS table. CUSTOMERS needs to be updated to reflect the latest information aboutthe customers.What is the error in the following MERGE statement?MERGE INTO customers cUSING customer_vu cvON (c.customer_id = cv.customer_id)Page 23 of 91
  24. 24. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168WHEN MATCHED THENUPDATE SETc.customer_id = cv.customer_id,c.cust_name = cv.cust_name,c.cust_email = cv.cust_email,c.income_level = cv.income_levelWHEN NOT MATCHED THENINSERT VALUES(cv.customer_id,cv.cust_name,cv.cust_email,cv,income_level)WHERE cv.income_level >100000;A. The CUSTOMER_ID column cannot be updated.B. The INTO clause is misplaced in the command.C. The WHERE clause cannot be used with INSERT.D. CUSTOMER_VU cannot be used as a data source.Answer: AQuestion: 46Which 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. The NOT operator can be used with IN, ANY and ALL operators.Answer: B, EQuestion: 47Given below are the SQL statements executed in a user session:CREATE TABLE product(pcode NUMBER(2),pname VARCHAR2(10));INSERT INTO product VALUES(1, pen);INSERT INTO product VALUES (2,pencil);SAVEPOINT a;UPDATE product SET pcode = 10 WHERE pcode = 1;SAVEPOINT b;DELETE FROM product WHERE pcode = 2;COMMIT;DELETE FROM product WHERE pcode=10;ROLLBACK TO SAVEPOINT a;Which statement describes the consequences?A. No SQL statement would be rolled back.B. Both the DELETE statements would be rolled back.C. Only the second DELETE statement would be rolled back.D. Both the DELETE statements and the UPDATE statement would be rolled back.Answer: AQuestion: 48Page 24 of 91
  25. 25. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Evaluate the following CREATE TABLE command:CREATE TABLE order_item(order_id NUMBER(3),item_id NUMBER(2),qty NUMBER(4),CONSTRAINT ord_itm_id_pkPRIMARY KEY (order_id,item_id)USING INDEX(CREATE INDEX ord_itm_idxON order_item(order_id,item_id)));Which statement is true regarding the above SQL statement?A. It would execute successfully and only ORD_ITM_IDX index would be created.B. It would give an error because the USING INDEX clause cannot be used on a composite primary key.C. It would execute successfully and two indexes ORD_ITM_IDX and ORD_ITM_ID_PK would be created.D. It would give an error because the USING INDEX clause is not permitted in the CREATE TABLE command.Answer: AQuestion: 49View 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 getthe maximum salary in their respective departments. The following SQL statement was written:WITH SELECT employee_id, last_name, salaryFROM employeesWHERE (department_id, salary) = ANY (SELECT *FROM dept_max)dept_max as ( SELECT d.department_id, max(salary)FROM departments d JOIN employees jON (d.department_id = j.department_id)GROUP BY d.department_id);Which statement is true regarding the execution and the output of this statement?Page 25 of 91
  26. 26. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. 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: CQuestion: 50View the Exhibit and examine the data in the DEPARTMENTS tables.Evaluate the following SQL statement:SELECT department_id "DEPT_ID", department_name , bFROM departmentsWHERE department_id=90UNIONSELECT department_id, department_name DEPT_NAME, aFROM departmentsWHERE department_id=10Which two ORDER BY clauses can be used to sort the output of the above statement? (Choosetwo.)A. ORDER BY 3;B. ORDER BY b;C. ORDER BY DEPT_ID;D. ORDER BY DEPT_NAME;Answer: A, CQuestion: 51View the Exhibit and examine the description of the EMPLOYEES table.Page 26 of 91
  27. 27. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You want to know the EMPLOYEE_ID and FIRST_NAME of all the records in the EMPLOYEEStable wherein the JOB_ID column has ST_CLERK or ST_MAN values, the DEPARTMENT_IDcolumn has value 30, and the SALARY column has a value greater than 3,000.Which SQL statement would get you the desired result?A. SELECT employee_id, first_name FROM employees WHERE job_id like MAN% OR job_id like CLERK% AND department_id = 30 AND salary > 3000;B. SELECT employee_id, first_name FROM employees WHERE job_id like %MAN OR job_id like %CLERK AND (department_id = 30 OR salary > 3000);C. SELECT employee_id, first_name FROM employees WHERE (job_id like %MAN AND job_id like %CLERK) AND department_id = 30 OR salary > 3000;D. SELECT employee_id, first_name FROM employees WHERE (job_id like %MAN OR job_id like %CLERK ) AND department_id = 30 AND salary > 3000;Answer: DQuestion: 52View the Exhibit and examine the structure of the ORDERS table.Page 27 of 91
  28. 28. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168The ORDERS table belongs to the user OE. HR is another user in the database.Evaluate the commands issued by users OE and HR in the following order:Statement 1 by user OE: GRANT SELECT,UPDATE(customer_id, order_total)ON ordersTO hr;Statement 1 by user HR: SELECT * FROM oe.orders;Statement 2 by user HR: UPDATE oe.ordersSET order_total= 10000;Which statement is true regarding the above commands?A. Statement 1 by user OE would not work because the statement has to be issued by the DBA.B. Statement 2 by user HR would not work because the grant is only for SELECT in a subquery of update.C. There are no errors in the statements issued by OE and HR; all the statements would execute successfully.D. Statement 1 by user HR would not work because SELECT and UPDATE privileges have been granted only on CUSTOMER_ID and ORDER_TOTAL columns.Answer: CQuestion: 53View 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 theorders in the ORDER_ITEMS table.Which query would produce the desired output?A. SELECT order_id FROM order_itemsPage 28 of 91
  29. 29. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168 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: DQuestion: 54Which two statements are true about sequences created in a single instance database? (Choosetwo.)A. The numbers generated by a sequence can be used only for one table.B. DELETE <sequencename> would remove a sequence from the database.C. CURRVAL is used to refer to the last sequence number that has been generated.D. When the MAXVALUE limit for a sequence is reached, you can increase the MAXVALUE limit by using the ALTER SEQUENCE statement.E. When a database instance shuts down abnormally, the sequence numbers that have been cached but not used would be available once again when the database instance is restarted.Answer: C, DQuestion: 55View the Exhibit and examine the structure of the EMPLOYEES and DEPARTMENTS tables.Which SET operator would you use in the blank space in the following SQL statement to list thedepartments where all the employees have managers?Page 29 of 91
  30. 30. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168SELECT department_idFROM departments____SELECT department_idFROM employeesWHERE manager_id IS NULL;A. UNIONB. MINUSC. INTERSECTD. UNION ALLAnswer: BQuestion: 56Which mandatory clause has to be added to the following statement to successfully create anexternal table called EMPDET?CREATE TABLE empdet(empno CHAR(2), ename CHAR(5), deptno NUMBER(4))ORGANIZATION EXTERNAL(LOCATION (emp.dat));A. TYPEB. REJECT LIMITC. DEFAULT DIRECTORYD. ACCESS PARAMETERSAnswer: CQuestion: 57View the Exhibit and examine the description of the ORDER_ITEMS andPRODUCT_INFORMATION tables.Page 30 of 91
  31. 31. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168The ORDER_ITEM table has records pertaining to details for each product in an order. ThePRODUCT_INFORMATION table has records for all the products available for ordering.Evaluate the following SQL statement:SELECT oi.order_id, pi.product_idFROM order_items oi RIGHT OUTER JOIN product_information piON (oi.product_id=pi.product_id);Which statement is true regarding the output of this SQL statement?A. The query would return the ORDER_ID and PRODUCT_ID for only those products that are ordered.B. The query would return the ORDER_ID and PRODUCT_ID for the products that are ordered as well as for the products that have never been ordered.C. The query would return the ORDER_ID and PRODUCT_ID for the products that are ordered but not listed in the PRODUCT_INFORMATION table.D. The query would return the ORDER_ID and PRODUCT_ID for those products that are ordered as well as for the products that have never been ordered, and for the products that are not listed in the PRODUCT_INFORMATION table.Answer: BQuestion: 58Evaluate the following statement:CREATE TABLE bonuses(employee_id NUMBER, bonus NUMBER DEFAULT 100);The details of all employees who have made sales need to be inserted into the BONUSES table.You can obtain the list of employees who have made sales based on the SALES_REP_IDcolumn of the ORDERS table.The human resources manager now decides that employees with a salary of $8,000 or lessshould receive a bonus. Those who have not made sales get a bonus of 1% of their salary. Thosewho have made sales get a bonus of 1% of their salary and also a salary increase of 1%. Thesalary of each employee can be obtained from the EMPLOYEES table.Which option should be used to perform this task most efficiently?A. MERGEB. Unconditional INSERTC. Conditional ALL INSERTD. Conditional FIRST INSERTAnswer: AQuestion: 59Which statement is true regarding the ROLLUP operator specified in the GROUP BY clause of aSQL statement?A. It produces only the subtotals for the groups specified in the GROUP BY clause.B. It produces only the grand totals for the groups specified in the GROUP BY clause.C. It produces higher-level subtotals, moving from right to left through the list of grouping columns specified in the GROUP BY clause.D. It produces higher-level subtotals, moving in all the directions through the list of grouping columns specified in the GROUP BY clause.Answer: CQuestion: 60View the Exhibit and examine DEPARTMENTS and the LOCATIONS tables.Page 31 of 91
  32. 32. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Evaluate the following SQL statement:SELECT location_id, cityFROM locationsl WHERE NOT EXISTS (SELECT location_idFROM departmentsWHERE location_id <> l.location_id);This statement was written to display LOCATION_ID and CITY where there are no departmentslocated. Which statement is true regarding the execution and output of the command?A. The statement would execute and would return the desired results.B. The statement would not execute because the = comparison operator is missing in the WHERE clause of the outer query.C. The statement would execute but it will return zero rows because the WHERE clause in the inner query should have the = operator instead of <>.D. The statement would not execute because the WHERE clause in the outer query is missing the column name for comparison with the inner query result.Answer: CQuestion: 61Evaluate 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,ename VARCHAR2(15),salary NUMBER(8,2),mgr_no NUMBER(2) CONSTRAINT emp_mgr_fk REFERENCES emp);ALTER TABLE empDISABLE CONSTRAINT emp_emp_no_pk CASCADE;ALTER TABLE empENABLE 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.Page 32 of 91
  33. 33. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168D. It would remain disabled and can be enabled only by dropping the foreign key constraint and re-creating it.Answer: CQuestion: 62View the Exhibit and examine the structure of the LOCATIONS and DEPARTMENTS tables.Which SET operator should be used in the blank space in the following SQL statement to displaythe cities that have departments located in them?SELECT location_id, cityFROM locations____SELECT location_id, cityFROM locations JOIN departmentsUSING(location_id);A. UNIONB. MINUSC. INTERSECTD. UNION ALLAnswer: CQuestion: 63Which CREATE TABLE statement is valid?A. CREATE TABLE ord_details (ord_no NUMBER(2) PRIMARY KEY, item_no NUMBER(3) PRIMARY KEY, ord_date date NOT NULL);B. CREATE TABLE ord_details (ord_no NUMBER(2) UNIQUE, NOT NULL, item_no NUMBER(3), ord_date date DEFAULT SYSDATE NOT NULL);C. CREATE TABLE ord_details (ord_no NUMBER(2) ,Page 33 of 91
  34. 34. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168 item_no NUMBER(3), ord_date date DEFAULT NOT NULL, CONSTRAINT ord_uq UNIQUE (ord_no), CONSTRAINT ord_pk PRIMARY KEY (ord_no));D. CREATE TABLE ord_details (ord_no NUMBER(2), item_no NUMBER(3), ord_date date DEFAULT SYSDATE NOT NULL, CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));Answer: DQuestion: 64Evaluate 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_constraintsWHERE table_name = ORDERSWhich two statements are true about the output? (Choose two.)A. In the second column, indicates a check constraint.B. The STATUS column indicates whether the table is currently in use.C. The R_CONSTRAINT_NAME column gives the alternative name for the constraint.D. The column DELETE_RULE decides the state of the related rows in the child table when the corresponding row is deleted from the parent table.Answer: A, DQuestion: 65Which statement is true regarding Flashback Version Query?A. It returns versions of rows only within a transaction.B. It can be used in subqueries contained only in a SELECT statement.C. It will return an error if the undo retention time is less than the lower bound time or SCN specified.D. It retrieves all versions including the deleted as well as subsequently reinserted versions of the rows.Answer: DQuestion: 66Which two statements are true regarding multiple-row subqueries? (Choose two.)Page 34 of 91
  35. 35. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. They can contain group functions.B. They always contain a subquery within a subquery.C. They use the < ALL operator to imply less than the maximum.D. They can be used to retrieve multiple rows from a single table only.E. They should not be used with the NOT IN operator in the main query if NULL is likely to be a part of the result of the subquery.Answer: A, EQuestion: 67View the Exhibit and examine the structure of the ORDERS table.The columns ORDER_MODE and ORDER_TOTAL have the default values direct and 0respectively.Which two INSERT statements are valid? (Choose two.)A. INSERT INTO orders VALUES (1, 09-mar-2007, online,,1000);B. INSERT INTO orders (order_id,order_date,order_mode, customer_id,order_total) VALUES(1,TO_DATE(NULL), online, 101, NULL);C. INSERT INTO (SELECT order_id,order_date,customer_id FROM orders) VALUES (1,09-mar-2007, 101);D. INSERT INTO orders VALUES (1,09-mar-2007, DEFAULT, 101, DEFAULT);E. INSERT INTO orders (order_id,order_date,order_mode,order_total) VALUES (1,10-mar-2007,online,1000);Answer: C, DQuestion: 68The following are the steps for a correlated subquery, listed in random order:1) The WHERE clause of the outer query is evaluated.2) The candidate row is fetched from the table specified in the outer query.3) The procedure is repeated for the subsequent rows of the table, till all the rows are processed.4) Rows are returned by the inner query, after being evaluated with the value from the candidate row in the outer query. Identify the option that contains the steps in the correct sequence in which the Oracle server evaluates a correlated subquery.Page 35 of 91
  36. 36. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. 4, 2, 1, 3B. 4, 1, 2, 3C. 2, 4, 1, 3D. 2, 1, 4, 3Answer: CQuestion: 69View the Exhibit and examine the structure of the EMPLOYEES table.Evaluate the following SQL statement:SELECT employee_id, last_name, job_id, manager_idFROM employeesSTART WITH employee_id = 101CONNECT BY PRIOR employee_id=manager_id;Which statement is true regarding the output for this command?A. It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by his or her peers.B. It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by the employee to whom he or she reports.C. It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101, followed by employees below him or her in the hierarchy.D. It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is101, followed by employees up to one level below him or her in the hierarchy.Answer: CQuestion: 70Which two statements are true about the GROUPING function? (Choose two.)A. It is used to find the groups forming the subtotal in a row.B. It is used to identify the NULL value in the aggregate functions.C. It is used to form the group sets involved in generating the totals and subtotals.D. It can only be used with ROLLUP and CUBE operators specified in the GROUP BY clause.Answer: A, DPage 36 of 91
  37. 37. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Question: 71Given below is a list of datetime data types and examples of values stored in them in a randomorder:Datatype Example1)INTERVAL YEAR TO MONTH a) 2003-04-15 8:00:00 -8:002)TIMESTAMP WITH LOCAL TIME ZONE b) +06 03:30:16.0000003)TIMESTAMP WITH TIME ZONE c) 17-JUN-03 12.00.00.000000 AM4)INTERVAL DAY TO SECOND d) +02-00Identify the option that correctly matches the data types with the values.A. 1-d, 2-c, 3-a, 4-bB. 1-b, 2-a, 3-c, 4-dC. 1-b, 2-a, 3-d, 4-cD. 1-d, 2-c, 3-b, 4-aAnswer: AQuestion: 72View the Exhibit and examine the description of the PRODUCT_INFORMATION table.You want to display the expiration date of the warranty for a product. Which SQL statement wouldyou execute?A. SELECT product_id, SYSDATE + warranty_period FROM product_information;B. SELECT product_id, TO_YMINTERVAL(warranty_period) FROM product_information;C. SELECT product_id, TO_YMINTERVAL(SYSDATE) + warranty_period FROM product_information;D. SELECT product_id, TO_YMINTERVAL(SYSDATE + warranty_period) FROM product_information;Page 37 of 91
  38. 38. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Answer: AQuestion: 73View the Exhibit and examine the structure of the ORDERS table.NEW_ORDERS is a new table with the columns ORD_ID, ORD_DATE, CUST_ID, andORD_TOTAL that have the same data types and size as the corresponding columns in theORDERS table.Evaluate the following INSERT statement:INSERT INTO new_orders (ord_id, ord_date, cust_id, ord_total)VALUES(SELECT order_id,order_date,customer_id,order_totalFROM ordersWHERE order_date > 31-dec-1999);Why would the INSERT statement fail?A. because column names in NEW_ORDERS and ORDERS tables do not matchB. because the VALUES clause cannot be used in an INSERT with a subqueryC. because the WHERE clause cannot be used in a subquery embedded in an INSERT statementD. because the total number of columns in the NEW_ORDERS table does not match the total number of columns in the ORDERS tableAnswer: BQuestion: 74View the Exhibit and examine the structure of the ORDER_ITEMS and ORDERS tables.Page 38 of 91
  39. 39. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You are asked to retrieve the ORDER_ID, PRODUCT_ID, and total price (UNIT_PRICEmultiplied by QUANTITY), where the total price is greater than 50,000.You executed the following SQL statement:SELECT order_id, product_id, unit_price*quantity "Total Price"FROM order_itemsWHERE unit_price*quantity > 50000NATURAL JOIN orders;Which statement is true regarding the execution of the statement?A. The statement would execute and provide the desired result.B. The statement would not execute because the ON keyword is missing in the NATURAL JOIN clause.C. The statement would not execute because the WHERE clause is before the NATURAL JOIN clause.D. The statement would not execute because the USING keyword is missing in the NATURAL JOIN clause.Answer: CQuestion: 75View the Exhibit and examine the structure of the EMPLOYEES table.Page 39 of 91
  40. 40. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You want to know the FIRST_NAME and SALARY for all employees who have the samemanager as that of the employee with the first name Neena and have salary equal to or greaterthan that of Neena.Which SQL statement would give you the desired result?A. SELECT first_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, salary FROM 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: DQuestion: 76View the Exhibit and examine the structure of the ORDERS table.Page 40 of 91
  41. 41. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Which UPDATE statement is valid?A. UPDATE orders SET order_date = 12-mar-2007, order_total IS NULL WHERE order_id = 2455;B. UPDATE orders SET order_date = 12-mar-2007, order_total = NULL WHERE order_id = 2455;C. UPDATE orders SET order_date = 12-mar-2007 AND order_total = TO_NUMBER(NULL) WHERE order_id = 2455;D. UPDATE orders SET order_date = TO_DATE(12-mar-2007,dd-mon-yyyy), SET order_total = TO_NUMBER(NULL) WHERE order_id = 2455;Answer: BQuestion: 77View the Exhibit and examine the descriptions for ORDERS and ORDER_ITEMS tables.Page 41 of 91
  42. 42. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Evaluate the following SQL statement:SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Order Amount"FROM order_items oi JOIN orders oON oi.order_id = o.order_idGROUP BY CUBE (o.customer_id, oi.product_id);Which three statements are true regarding the output of this SQL statement? (Choose three.)A. It would return the subtotals for the Order Amount of every CUSTOMER_ID.B. It would return the subtotals for the Order Amount for every PRODUCT_ID.C. It would return the subtotals for the Order Amount of every PRODUCT_ID and CUSTOMER_ID as one group.D. It would return the subtotals for the Order Amount of every CUSTOMER_ID and PRODUCT_ID as one group.E. It would return only the grand total for the Order Amount of every CUSTOMER_ID and PRODUCT_ID as one group.Answer: A, B, DQuestion: 78View the Exhibit and examine the details of the EMPLOYEES table.Page 42 of 91
  43. 43. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You want to generate a hierarchical report for all the employees who report to the employeewhose EMPLOYEE_ID is 100.Which SQL clauses would you require to accomplish the task? (Choose all that apply.)A. WHEREB. HAVINGC. GROUP BYD. START WITHE. CONNECT BYAnswer: A, D, EQuestion: 79View the Exhibit and examine the data in ORDERS_MASTER and MONTHLY_ORDERS tables.Evaluate the following MERGE statement:MERGE INTO orders_master oUSING monthly_orders mPage 43 of 91
  44. 44. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168ON (o.order_id = m.order_id)WHEN MATCHED THENUPDATE SET o.order_total = m.order_totalDELETE WHERE (m.order_total IS NULL)WHEN NOT MATCHED THENINSERT VALUES (m.order_id, m.order_total);What would be the outcome of the above statement?A. The ORDERS_MASTER table would contain the ORDER_IDs 1 and 2.B. The ORDERS_MASTER table would contain the ORDER_IDs 1, 2 and 3.C. The ORDERS_MASTER table would contain the ORDER_IDs 1, 2 and 4.D. The ORDERS_MASTER table would contain the ORDER_IDs 1, 2, 3 and 4.Answer: CQuestion: 80Evaluate the following ALTER TABLE statement:ALTER TABLE ordersSET UNUSED order_date;Which statement is true?A. The DESCRIBE command would still display the ORDER_DATE column.B. ROLLBACK can be used to get back the ORDER_DATE column in the ORDERS table.C. The ORDER_DATE column should be empty for the ALTER TABLE command to execute successfully.D. After executing the ALTER TABLE command, you can add a new column called ORDER_DATE to the ORDERS table.Answer: DQuestion: 81View the Exhibit and examine the ORDERS table.The ORDERS table contains data and all orders have been assigned a customer ID. Whichstatement 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;Page 44 of 91
  45. 45. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Answer: BQuestion: 82Which three statements indicate the end of a transaction? (Choose three.)A. after a COMMIT is issuedB. after a ROLLBACK is issuedC. after a SAVEPOINT is issuedD. after a SELECT statement is issuedE. after a CREATE statement is issuedAnswer: A, B, EQuestion: 83View the Exhibit and examine the structure of the ORDERS table.You have to display ORDER_ID, ORDER_DATE, and CUSTOMER_ID for all those orders thatwere placed after the last order placed by the customer whose CUSTOMER_ID is 101.Which query would give you the desired output?A. SELECT order_id, order_date FROM orders WHERE order_date > ALL (SELECT MAX(order_date) FROM orders ) AND customer_id = 101;B. SELECT order_id, order_date FROM orders WHERE order_date > ANY (SELECT order_date FROM orders WHERE customer_id = 101);C. SELECT order_id, order_date FROM orders WHERE order_date > ALL (SELECT order_date FROM orders WHERE customer_id = 101);D. SELECT order_id, order_date FROM ordersPage 45 of 91
  46. 46. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168 WHERE order_date IN (SELECT order_date FROM orders WHERE customer_id = 101);Answer: CQuestion: 84You need to create a table with the following column specifications:1. Employee ID (numeric data type) for each employee2. Employee Name, (character data type) which stores the employee name3. Hire date, to store the date when the employee joined the organization4. Status (character data type). It should contain the value if no data is entered.5. Resume (character large object [CLOB] data type), which would contain the resume submitted by the employeeWhich is the correct syntax to create this table?A. CREATE TABLE EMP_1 (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, e_status VARCHAR2(10) DEFAULT ACTIVE, resume CLOB(200));B. CREATE TABLE 1_EMP (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT ACTIVE, resume CLOB);C. CREATE TABLE 1_EMP (emp_id NUMBER(4), emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT "ACTIVE", resume CLOB);D. CREATE TABLE EMP_1 (emp_id NUMBER, emp_name VARCHAR2(25), start_date DATE, emp_status VARCHAR2(10) DEFAULT ACTIVE, resume CLOB);Answer: DQuestion: 85The details of the order ID, order date, order total, and customer ID are obtained from theORDERS table. If the order value is more than 30000, the details have to be added to theLARGE_ORDERS table. The order ID, order date, and order total should be added to theORDER_HISTORY table, and order ID and customer ID should be added to theCUST_HISTORY table. Which multitable INSERT statement would you use?A. Pivoting INSERTB. Unconditional INSERTC. Conditional ALL INSERTPage 46 of 91
  47. 47. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168D. Conditional FIRST INSERTAnswer: CQuestion: 86View the Exhibit and examine the description of the EMPLOYEES table.Evaluate the following SQL statement:SELECT first_name, employee_id, NEXT_DAY(ADD_MONTHS(hire_date, 6), 1) "Review" FROMemployees; The query was written to retrieve the FIRST_NAME, EMPLOYEE_ID, and reviewdate for employees.The review date is the first Monday after the completion of six months of the hiring. TheNLS_TERRITORY parameter is set to AMERICA in the session.Which statement is true regarding this query?A. The query would execute to give the desired output.B. The query would not execute because date functions cannot be nested.C. The query would execute but the output would give review dates that are Sundays.D. The query would not execute because the NEXT_DAY function accepts a string as argument.Answer: CQuestion: 87View the Exhibit and examine the structure of the EMPLOYEES table.Page 47 of 91
  48. 48. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You want to display all employees and their managers having 100 as the MANAGER_ID. Youwant the output in two columns: the first column would have the LAST_NAME of the managersand the second column would have LAST_NAME of the employees.Which SQL statement would you execute?A. SELECT m.last_name "Manager", e.last_name "Employee" FROM employees m JOIN employees e ON m.employee_id = e.manager_id WHERE m.manager_id=100;B. SELECT m.last_name "Manager", e.last_name "Employee" FROM employees m JOIN employees e ON m.employee_id = e.manager_id WHERE e.manager_id=100;C. SELECT m.last_name "Manager", e.last_name "Employee" FROM employees m JOIN employees e ON e.employee_id = m.manager_id WHERE m.manager_id=100;D. SELECT m.last_name "Manager", e.last_name "Employee" FROM employees m JOIN employees e WHERE m.employee_id = e.manager_id AND e.manager_id=100;Answer: BQuestion: 88View the Exhibit1 and examine the descriptions of the EMPLOYEES and DEPARTMENTS tables.Page 48 of 91
  49. 49. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168The following SQL statement was executed:SELECT e.department_id, e.job_id, d.location_id, sum(e.salary) total,GROUPING(e.department_id) GRP_DEPT,GROUPING(e.job_id) GRP_JOB,GROUPING(d.location_id) GRP_LOCFROM employees e JOIN departments dON e.department_id = d.department_idGROUP BY ROLLUP (e.department_id, e.job_id, d.location_id);View the Exhibit2 and examine the output of the command.Which two statements are true regarding the output? (Choose two.)A. The value 1 in GRP_LOC means that the LOCATION_ID column is taken into account to generate the subtotal.B. The value 1 in GRP_JOB and GRP_LOC means that JOB_ID and LOCATION_ID columns are not taken into account to generate the subtotal.C. The value 1 in GRP_JOB and GRP_LOC means that the NULL value in JOB_ID and LOCATION_ID columns are taken into account to generate the subtotal.D. The value 0 in GRP_DEPT, GRP_JOB, and GRP_LOC means that DEPARTMENT_ID, JOB_ID, and LOCATION_ID columns are taken into account to generate the subtotal.Answer: B, DQuestion: 89View the Exhibit and examine the description of the DEPARTMENTS and EMPLOYEES tables.Page 49 of 91
  50. 50. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168To retrieve data for all the employees for their EMPLOYEE_ID, FIRST_NAME, andDEPARTMENTNAME, the following SQL statement was written:SELECT employee_id, first_name, department_nameFROM employeesNATURAL JOIN departments;The desired output is not obtained after executing the above SQL statement. What could be thereason 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: DQuestion: 90View the Exhibit and examine the descriptions of the DEPT and LOCATIONS tables.You want to update the CITY column of the DEPT table for all the rows with the correspondingvalue in the CITY column of the LOCATIONS table for each department.Which SQL statement would you execute to accomplish the task?Page 50 of 91
  51. 51. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. UPDATE dept d SET city = ANY (SELECT city FROM locations l);B. UPDATE dept d SET city = (SELECT city FROM locations l) WHERE d.location_id = l.location_id;C. UPDATE dept d SET city = (SELECT city FROM locations l WHERE d.location_id = l.location_id);D. UPDATE dept d SET city = ALL (SELECT city FROM locations l WHERE d.location_id = l.location_id);Answer: CQuestion: 91View the Exhibit and examine the data in the LOCATIONS table.Evaluate the following SQL statement:SELECT street_addressFROM locationsWHEREREGEXP_INSTR(street_address,[^[:alpha:]]) = 1;Which statement is true regarding the output of this SQL statement?A. It would display all the street addresses that do not have a substring alpha.B. It would display all the street addresses where the first character is a special character.C. It would display all the street addresses where the first character is a letter of the alphabet.D. It would display all the street addresses where the first character is not a letter of the alphabet.Answer: DQuestion: 92Evaluate the following expression using meta character for regular expression:[^Ale|ax.r$]Page 51 of 91
  52. 52. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Which two matches would be returned by this expression? (Choose two.)A. AlexB. AlaxC. AlxerD. AlaxendarE. AlexenderAnswer: D, EQuestion: 93The ORDERS table belongs to the user OE. OE has granted the SELECT privilege on theORDERS table to the user HR.Which statement would create a synonym ORD so that HR can execute the following querysuccessfully?SELECT * FROM ord;A. CREATE SYNONYM ord FOR orders; This command is issued by OE.B. CREATE PUBLIC SYNONYM ord FOR orders; This command is issued by OE.C. CREATE SYNONYM ord FOR oe.orders; This command is issued by the database administrator.D. CREATE PUBLIC SYNONYM ord FOR oe.orders; This command is issued by the database administrator.Answer: DQuestion: 94View 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 theemployees, 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 eON (m.employee_id = e.manager_id)WHERE e.manager_id=100JOIN departments dON (e.department_id = d.department_id);Which statement is true regarding the output of this SQL statement?Page 52 of 91
  53. 53. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. The statement would provide the desired results.B. The statement would not execute because the ON clause is written twice.C. The statement would not execute because the WHERE clause is wrongly placed.D. The statement would not execute because the self join uses the ON clause instead of the USING clause.Answer: CQuestion: 95Evaluate the following DELETE statement:DELETE FROM orders;There are no other uncommitted transactions on the ORDERS table.Which statement is true about the DELETE statement?A. It removes all the rows in the table and allows ROLLBACK.B. It would not remove the rows if the table has a primary key.C. It removes all the rows as well as the structure of the table.D. It removes all the rows in the table and does not allow ROLLBACK.Answer: AQuestion: 96View 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 DELETECASCADE option.Which DELETE statement would execute successfully?A. DELETE order_id FROM orders WHERE order_total < 1000;Page 53 of 91
  54. 54. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168B. 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: BQuestion: 97View 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) totalFROM employees e JOIN departments dON e.department_id = d.department_idGROUP 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. The output would display the total salary for all the departments.B. The output would display the total salary for all the JOB_IDs in a department.C. The output would display only the grand total of the salary for all JOB_IDs in a LOCATION_ID.D. The output would display the grand total of the salary for only the groups specified in the GROUP BY clause.Answer: A, BQuestion: 98View the Exhibit and examine the data in EMP and DEPT tables.Page 54 of 91
  55. 55. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168In the DEPT table, DEPTNO is the PRIMARY KEY.In the EMP table, EMPNO is the PRIMARY KEY and DEPTNO is the FOREIGN KEY referencingthe 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: DQuestion: 99View the Exhibit and examine the structure of the ORDERS table.Page 55 of 91
  56. 56. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168The ORDER_ID column is the PRIMARY KEY in the ORDERS table.Evaluate the following CREATE TABLE command:CREATE TABLE new_orders(ord_id, ord_date DEFAULT SYSDATE, cust_id) ASSELECT order_id,order_date,customer_idFROM orders;Which statement is true regarding the above command?A. The NEW_ORDERS table would not get created because the DEFAULT value cannot be specified in the column definition.B. The NEW_ORDERS table would get created and only the NOT NULL constraint defined on the specified columns would be passed to the new table.C. The NEW_ORDERS table would not get created because the column names in the CREATE TABLE command and the SELECT clause do not match.D. The NEW_ORDERS table would get created and all the constraints defined on the specified columns in the ORDERS table would be passed to the new table.Answer: BQuestion: 100Which two statements are true regarding the GROUP BY clause in a SQL statement? (Choosetwo.)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: D, EQuestion: 101Which statement is true regarding synonyms?A. Synonyms can be created for tables but not views.B. Synonyms are used to reference only those tables that are owned by another user.C. A public synonym and a private synonym can exist with the same name for the same table.D. The DROP SYNONYM statement removes the synonym, and the status of the table on which the synonym has been created becomes invalid.Answer: CQuestion: 102Evaluate 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));Page 56 of 91
  57. 57. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168You issue the following command to create a view that displays the IDs and last names of thesales staff in the organization:CREATE OR REPLACE VIEW sales_staff_vu ASSELECT employee_id, last_name,job_idFROM employeesWHERE 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 all new staff into the EMPLOYEES table.B. It allows you to delete the details of the existing sales staff from the EMPLOYEES table.C. It allows you to update the job ids of the existing 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 the view if it is used in multitable INSERT statements.Answer: B, DQuestion: 103View the Exhibit and examine the structure of EMPLOYEES and JOB_HISTORY tables.The EMPLOYEES table maintains the most recent information regarding salary, department, andjob for all the employees. The JOB_HISTORY table maintains the record for all the job changesfor the employees. You want to delete all the records from the JOB_HISTORY table that arerepeated in the EMPLOYEES table.Which two SQL statements can you execute to accomplish the task? (Choose two.)A. DELETE FROM job_history j WHERE employee_id = (SELECT employee_id FROM employees e WHERE j.employee_id = e.employee_id) AND job_id = (SELECT job_id FROM employees e WHERE j.job_id = e.job_id);B. DELETE FROM job_history j WHERE (employee_id, job_id) = ALL (SELECT employee_id, job_idPage 57 of 91
  58. 58. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168 FROM employees e WHERE j.employee_id = e.employee_id and j.job_id = e.job_id )C. DELETE FROM job_history j WHERE employee_id = (SELECT employee_id FROM employees e WHERE j.employee_id = e.employee_id and j.job_id = e.job_id )D. DELETE FROM job_history j WHERE (employee_id, job_id) = (SELECT employee_id, job_id FROM employees e WHERE j.employee_id = e.employee_id and j.job_id = e.job_id )Answer: C, DQuestion: 104The user SCOTT who is the owner of ORDERS and ORDER_ITEMS tables issues the followingGRANT command:GRANT ALLON orders, order_itemsTO PUBLIC;What correction needs to be done to the above statement?A. PUBLIC should be replaced with specific usernames.B. ALL should be replaced with a list of specific privileges.C. WITH GRANT OPTION should be added to the statement.D. Separate GRANT statements are required for ORDERS and ORDER_ITEMS tables.Answer: DQuestion: 105Given below is a list of functions and the tasks performed by using these functions, in randomorder.Function Usage1) LPAD a) Used to truncate a column, expression, or value to n decimal places2) TRUNC b) Used to remove heading or trailing or both characters from the character string3) DECODE c) Pads the character value right-justified to a total width of n character positions4) TRIM d) Used to return the numeric value for position of a named character from the character string5) INSTR e) Used to translate an expression after comparing it with each search valueWhich option correctly matches the function names with their usage?A. 1-c, 2-b, 3-e, 4-a, 5-dB. 1-e, 2-b, 3-c, 4-a, 5-dC. 1-e, 2-a, 3-c, 4-d, 5-bD. 1-c, 2-a, 3-e, 4-b, 5-dAnswer: DQuestion: 106Page 58 of 91
  59. 59. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Which statement is true regarding the CUBE operator in the GROUP BY clause of a SQLstatement?A. It produces only aggregates for the groups specified in the GROUP BY clause.B. It finds all the NULL values in the superaggregates for the groups specified in the GROUP BY clause.C. It produces 2 n possible superaggregate combinations, if the n columns and expressions are specified in the GROUP BY clause.D. It produces n+1 possible superaggregate combinations, if the n columns and expressions are specified in the GROUP BY clause.Answer: CQuestion: 107Which statement is true regarding the SESSION_PRIVS dictionary view?A. It contains the current object privileges available in the user session.B. It contains the current system privileges available in the user session.C. It contains the object privileges granted to other users by the current user session.D. It contains the system privileges granted to other users by the current user session.Answer: BQuestion: 108View the Exhibit and examine the details for the CATEGORIES_TAB table.Evaluate the following incomplete SQL statement:SELECT category_name,category_descriptionPage 59 of 91
  60. 60. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168FROM categories_tabYou want to display only the rows that have harddisks as part of the string in theCATEGORY_DESCRIPTION column.Which two WHERE clause options can give you the desired result? (Choose two.)A. WHERE REGEXP_LIKE (category_description, hard+.s);B. WHERE REGEXP_LIKE (category_description, ^H|hard+.s);C. WHERE REGEXP_LIKE (category_description, ^H|hard+.s$);D. WHERE REGEXP_LIKE (category_description, [^H|hard+.s]);Answer: A, BQuestion: 109Which two statements are true regarding roles? (Choose two.)A. A role can be granted to itself.B. A role can be granted to PUBLIC.C. A user can be granted only one role at any point of time.D. The REVOKE command can be used to remove privileges but not roles from other users.E. Roles are named groups of related privileges that can be granted to users or other roles.Answer: B, EQuestion: 110View the Exhibit and examine the data in the CUST_DET table.You executed the following multitable INSERT statement:INSERT FIRSTWHEN credit_limit >= 5000 THENINTO cust_1 VALUES(cust_id, credit_limit, grade, gender)WHEN grade = THENINTO cust_2 VALUES(cust_id, credit_limit, grade, gender)WHEN grade = THENINTO cust_3 VALUES(cust_id, credit_limit, grade, gender)INTO cust_4 VALUES(cust_id, credit_limit, grade, gender)ELSEINTO cust_5 VALUES(cust_id, credit_limit, grade, gender)SELECT * FROM cust_det;The row will be inserted in _______.A. CUST_1 table only because CREDIT_LIMIT condition is satisfiedB. CUST_1 and CUST_2 tables because CREDIT_LIMIT and GRADE conditions are satisfiedC. CUST_1,CUST_2 and CUST_5 tables because CREDIT_LIMIT and GRADE conditions are satisfied but GENDER condition is not satisfiedD. CUST_1, CUST_2 and CUST_4 tables because CREDIT_LIMIT and GRADE conditions are satisfied for CUST_1 and CUST_2, and CUST_4 has no condition on itAnswer: AQuestion: 111Page 60 of 91
  61. 61. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168View the Exhibit and examine the data in the EMPLOYEES tables.Evaluate the following SQL statement:SELECT employee_id, department_idFROM employeesWHERE department_id= 50 ORDER BY department_idUNIONSELECT employee_id, department_idFROM employeesWHERE department_id= 90UNIONSELECT employee_id, department_idFROM employeesWHERE department_id= 10;What would be the outcome of the above SQL statement?A. The statement would execute successfully and display all the rows in the ascending order of DEPARTMENT_ID.B. The statement would execute successfully but it will ignore the ORDER BY clause and display the rows in random order.C. The statement would not execute because the positional notation instead of the column name should be used with the ORDER BY clause.D. The statement would not execute because the ORDER BY clause should appear only at the end of the SQL statement, that is, in the last SELECT statement.Answer: DQuestion: 112Evaluate 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_orderVALUES(1, TIMESTAMP ?007-05-10 6:00:00 -5:00?);Which statement is true?Page 61 of 91
  62. 62. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. When the New York user selects the row, booking_date is displayed as 007-05-10 3.00.00.000000B. When the New York user selects the row, booking_date is displayed as 2007-05-10 6.00.00.000000 -5:00.C. When the San Francisco user selects the row, booking_date is displayed as 007-05-10 3.00.00.000000D. When the San Francisco user selects the row, booking_date is displayed as 007-05-10 3.00.00.000000 -8:00Answer: CQuestion: 113Which statements are true? (Choose all that apply.)A. The data dictionary is created and maintained by the database administrator.B. The data dictionary views can consist of joins of dictionary base tables and user-defined tables.C. The usernames of all the users including the database administrators are stored in the data dictionary.D. The USER_CONS_COLUMNS view should be queried to find the names of the columns to which a constraint applies.E. Both USER_OBJECTS and CAT views provide the same information about all the objects that are owned by the user.F. Views with the same name but different prefixes, such as DBA, ALL and USER, use the same base tables from the data dictionaryAnswer: C, D, FQuestion: 114View the Exhibit and examine the details of the PRODUCT_INFORMATION table.You have the requirement to display PRODUCT_NAME and LIST_PRICE from the table wherethe CATEGORY_ID column has values 12 or 13, and the SUPPLIER_ID column has the value102088. You executed the following SQL statement:SELECT product_name, list_priceFROM product_informationWHERE (category_id = 12 AND category_id = 13) AND supplier_id = 102088;Which statement is true regarding the execution of the query?Page 62 of 91
  63. 63. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168A. It would execute but the output would return no rows.B. It would execute and the output would display the desired result.C. It would not execute because the entire WHERE clause condition is not enclosed within the parentheses.D. It would not execute because the same column has been used in both sides of the AND logical operator to form the condition.Answer: AQuestion: 115Given below is the list of meta character syntaxes and their descriptions in random order:Meta character syntax Description1) ^ a) Matches character not in the list2) [^...] b) Matches character when it occurs at the beginning of a line3) | c) Treats the subsequent meta character as a literal4) d) Matches one of the characters such as the OR operatorIdentify the option that correctly matches the meta character syntaxes with their descriptions.A. 1-b, 2-a, 3-d, 4-cB. 1-a, 2-b, 3-d, 4-cC. 1-d, 2-b, 3-a, 4-cD. 1-b, 2-c, 3-d, 2-aAnswer: AQuestion: 116View the Exhibit and examine the structure of ORDERS and CUSTOMERS tables.Evaluate the following UPDATE statement:UPDATE(SELECT order_date, order_total, customer_idPage 63 of 91
  64. 64. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168FROM orders)SET order_date = 22-mar-2007WHERE customer_id =(SELECT customer_idFROM customersWHERE cust_last_name = Roberts ANDcredit_limit = 600);Which statement is true regarding the execution of the above UPDATE statement?A. It would not execute because two tables cannot be used in a single UPDATE statement.B. It would execute and restrict modifications to only the columns specified in the SELECT statement.C. It would not execute because a subquery cannot be used in the WHERE clause of an UPDATE statement.D. It would not execute because the SELECT statement cannot be used in place of the table name.Answer: BQuestion: 117Which statement correctly differentiates a system privilege from an object privilege?A. System privileges can be granted only by the DBA whereas object privileges can be granted by DBAs or the owner of the object.B. System privileges give the rights to only create user schemas whereas object privileges give rights to manipulate objects in a schema.C. Users require system privileges to gain access to the database whereas they require object privileges to create objects in the database.D. A system privilege is the right to perform specific activities in a database whereas an object privilege is a right to perform activities on a specific object in the database.Answer: DQuestion: 118View the Exhibit and examine the data in the PRODUCT_INFORMATION table.Which two tasks would require subqueries? (Choose two.)A. displaying the minimum list price for each product statusB. displaying all supplier IDs whose average list price is more than 500C. displaying the number of products whose list prices are more than the average list priceD. displaying all the products whose minimum list prices are more than the average list price of products having the product status orderablePage 64 of 91
  65. 65. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168E. displaying the total number of products supplied by supplier 102071 and having product status OBSOLETEAnswer: C, DQuestion: 119Which two statements are true regarding constraints? (Choose two.)A. A foreign key cannot contain NULL values.B. A column with the UNIQUE constraint can contain NULL.C. A constraint is enforced only for the INSERT operation on a table.D. A constraint can be disabled even if the constraint column contains data.E. All the constraints can be defined at the column level as well as the table level.Answer: B, DQuestion: 120View the Exhibit and examine the description of the ORDER_ITEMS table.The following SQL statement was written to retrieve the rows for the PRODUCT_ID that has aUNIT_PRICE of more than 1,000 and has been ordered more than five times:SELECT product_id, COUNT(order_id) total, unit_priceFROM order_itemsWHERE unit_price>1000 AND COUNT(order_id)>5GROUP BY product_id, unit_price;Which statement is true regarding this SQL statement?A. The statement would execute and give you the desired result.B. The statement would not execute because the aggregate function is used in the WHERE clause.C. The statement would not execute because the WHERE clause should have the OR logical operator instead of AND.D. The statement would not execute because in the SELECT clause, the UNIT_PRICE column is placed after the column having the aggregate function.Page 65 of 91
  66. 66. Exam Name: Oracle Database SQL ExpertExam Type OracleExam Code: 1Z0-047 Total Questions: 168Answer: BQuestion: 121Which two statements best describe the benefits of using the WITH clause? (Choose two.)A. It enables users to store the results of a query permanently.B. It enables users to store the query block permanently in the memory and use it to create complex queries.C. It enables users to reuse the same query block in a SELECT statement, if it occurs more than once in a complex query.D. It can improve the performance of a large query by storing the result of a query block having the WITH clause in the users temporary tablespace.Answer: C, DQuestion: 122View the Exhibit and examine the structure of the ORDERS and ORDER_ITEMS tables.In the ORDERS table, ORDER_ID is the PRIMARY KEY and ORDER_DATE has the DEFAULTvalue as SYSDATE.Evaluate the following statement:UPDATE ordersSET order_date=DEFAULTWHERE order_id IN (SELECT order_id FROM order_itemsWHERE qty IS NULL);What would be the outcome of the above statement?A. The UPDATE statement would not work because the main query and the subquery use different tables.B. The UPDATE statement would not work because the DEFAULT value can be used only in INSERT statements.C. The UPDATE statement would change all ORDER_DATE values to SYSDATE provided the current ORDER_DATE is NOT NULL and QTY is NULL.D. The UPDATE statement would change all the ORDER_DATE values to SYSDATE irrespective of what the current ORDER_DATE value is for all orders where QTY is NULL.Answer: DPage 66 of 91

×