anillvap
Quiz by , created more than 1 year ago

Quiz on 1Z0-047_2.pdf - Part I , created by anillvap on 27/01/2014.

660
0
0
anillvap
Created by anillvap almost 11 years ago
Close

1Z0-047_2.pdf - Part I

Question 1 of 56

1

You need to load information about new customers from the NEW_CUST table into the tables

CUST and CUST_SPECIAL. If a new customer has a credit limit greater than 10,000, then the

details have to be inserted into CUST_SPECIAL. All new customer details have to be inserted

into the CUST table. Which technique should be used to load the data most efficiently?

Select one or more of the following:

  • external table

  • the MERGE command

  • the multitable INSERT command

  • INSERT using WITH CHECK OPTION

Explanation

Question 2 of 56

1

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

You want to add a constraint on the CUST_FIRST_NAME column of the CUSTOMERS table so

that the value inserted in the column does not have numbers.

Which SQL statement would you use to accomplish the task?

Select one or more of the following:

  • ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name

    CHECK(REGEXP_LIKE(cust_first_name,'^A-Z'))NOVALIDATE ;

  • ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name

    CHECK(REGEXP_LIKE(cust_first_name,'^[0-9]'))NOVALIDATE ;

  • ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name

    CHECK(REGEXP_LIKE(cust_first_name,'[[:alpha:]]'))NOVALIDATE ;

  • ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name

    CHECK(REGEXP_LIKE(cust_first_name,'[[:digit:]]'))NOVALIDATE ;

Explanation

Question 3 of 56

1

Which three tasks can be performed using regular expression support in Oracle Database 10g?

(Choose three.)

Select one or more of the following:

  • A. It can be used to concatenate two strings.

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

  • C. It can be used for string manipulation and searching operations.

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

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

Explanation

Question 4 of 56

1

View the Exhibit and examine the structure of the EMP table which is not partitioned and not an

index-organized table.
Evaluate the following SQL statement:

ALTER TABLE emp

DROP COLUMN first_name;

Which two statements is true regarding the above command? (Choose two.)

Select one or more of the following:

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

Explanation

Question 5 of 56

1

Evaluate the CREATE TABLE statement:

CREATE TABLE products

(product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY,

product_name VARCHAR2(15));

Which statement is true regarding the PROD_ID_PK constraint?

Select one or more of the following:

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

Explanation

Question 6 of 56

1

Which two statements are true? (Choose two.)

Select one or more of the following:

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

Explanation

Question 7 of 56

1

View the Exhibit and examine the description of the ORDERS table.
Which two WHERE clause conditions demonstrate the correct usage of conversion functions?

(Choose two.)

Select one or more of the following:

  • A. WHERE order_date > TO_DATE('JUL 10 2006','MON DD YYYY')

  • B. WHERE TO_CHAR(order_date,'MON DD YYYY') = 'JAN 20 2003'

  • C. 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') )

Explanation

Question 8 of 56

1

View the Exhibit and examine the description of the EMPLOYEES table.
Your company decided to give a monthly bonus of $50 to all the employees who have completed

five 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 employees

WHERE MONTHS_BETWEEN(SYSDATE, hire_date)/12 >= 5;

When you execute the statement, the "Annual Compensation" is not computed correctly. What

changes would you make to the query to calculate the annual compensation correctly?

Select one or more of the following:

  • 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".

Explanation

Question 9 of 56

1

Evaluate the following CREATE SEQUENCE statement:

CREATE SEQUENCE seq1

START WITH 100

INCREMENT BY 10

MAXVALUE 200

CYCLE

NOCACHE;

The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue the

following SQL statement:

SELECT seq1.nextval FROM dual;

What is displayed by the SELECT statement?

Select one or more of the following:

  • A. 1

  • B. 10

  • C. 100

  • D. an error

Explanation

Question 10 of 56

1

View the Exhibit and examine the description of the EMPLOYEES table.
You want to display the EMPLOYEE_ID, FIRST_NAME, and DEPARTMENT_ID for all the

employees who work in the same department and have the same manager as that of the

employee having EMPLOYEE_ID 104. To accomplish the task, you execute the following SQL

statement:

SELECT employee_id, first_name, department_id

FROM employees

WHERE (manager_id, department_id) =(SELECT department_id, manager_id

FROM employees

WHERE employee_id = 104)

AND employee_id <> 104;

When you execute the statement it does not produce the desired output. What is the reason for

this?

Select one or more of the following:

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

Explanation

Question 11 of 56

1

View the Exhibit and examine the descriptions of ORDER_ITEMS and ORDERS tables.
You want to display the CUSTOMER_ID, PRODUCT_ID, and total (UNIT_PRICE multiplied by

QUANTITY) for the order placed. You also want to display the subtotals for a CUSTOMER_ID as

well as for a PRODUCT_ID for the last six months.

Which SQL statement would you execute to get the desired output?

Select one or more of the following:

  • 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) ;

Explanation

Question 12 of 56

1

View the Exhibit and examine the structure of the EMPLOYEES table.
You want to retrieve hierarchical data of the employees using the top-down hierarchy. Which SQL

clause would let you choose the direction to walk through the hierarchy tree?

Select one or more of the following:

  • A. WHERE

  • B. HAVING

  • C. GROUP BY

  • D. START WITH

  • E. CONNECT BY PRIOR

Explanation

Question 13 of 56

1

Which two statements is true regarding the execution of the correlated subqueries? (Choose

two.)

Select one or more of the following:

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

Explanation

Question 14 of 56

1

OE and SCOTT are the users in the database. The ORDERS table is owned by OE. Evaluate the

statements 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?

Select one or more of the following:

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

  • D. The REVOKE statement would give an error because the SELECT privilege has been granted

    to the role R1.

Explanation

Question 15 of 56

1

Evaluate the following SQL statement:

ALTER TABLE hr.emp

SET UNUSED (mgr_id);

Which statement is true regarding the effect of the above SQL statement?

Select one or more of the following:

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

Explanation

Question 16 of 56

1

EMPDET is an external table containing the columns EMPNO and ENAME.

Which command would work in relation to the EMPDET table?

Select one or more of the following:

  • 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);

Explanation

Question 17 of 56

1

View the Exhibit and examine the structure of the MARKS_DETAILS and MARKStables.
Which is the best method to load data from the MARKS_DETAILStable to the MARKStable?

Select one or more of the following:

  • A. Pivoting INSERT

  • B. Unconditional INSERT

  • C. Conditional ALL INSERT

  • D. Conditional FIRST INSERT

Explanation

Question 18 of 56

1

View the Exhibit and examine the data in ORDERS and ORDER_ITEMS tables.
You need to create a view that displays the ORDER ID, ORDER_DATE, and the total number of

items in each order.

Which CREATE VIEW statement would create the view successfully?

Select one or more of the following:

  • 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;

Explanation

Question 19 of 56

1

View the Exhibit and examine PRODUCTS and ORDER_ITEMS tables.
You executed the following query to display PRODUCT_NAME and the number of times the

product has been ordered:

SELECT p.product_name, i.item_cnt

FROM (SELECT product_id, COUNT (*) item_cnt

FROM order_items

GROUP BY product_id) i RIGHT OUTER JOIN products p

ON i.product_id = p.product_id;

What would happen when the above statement is executed?

Select one or more of the following:

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

Explanation

Question 20 of 56

1

In which scenario would you use the ROLLUP operator for expression or columns within a

GROUP BY clause?

Select one or more of the following:

  • A. to find the groups forming the subtotal in a row

  • B. to create group-wise grand totals for the groups specified within a GROUP BY clause

  • C. to create a grouping for expressions or columns specified within a GROUP BY clause in one

    direction, from right to left for calculating the subtotals

  • D. 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 subtotals

Explanation

Question 21 of 56

1

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

Evaluate the following SQL statement:

SELECT phone_number,

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

"PHONE NUMBER"

FROM employees;

The query was written to format the PHONE_NUMBER for the employees. Which option would

be the correct format in the output?

Select one or more of the following:

  • A. xxx-xxx-xxxx

  • B. (xxx) xxxxxxx

  • C. (xxx) xxx-xxxx

  • D. xxx-(xxx)-xxxx

Explanation

Question 22 of 56

1

Which statement correctly grants a system privilege?

Select one or more of the following:

  • 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;

Explanation

Question 23 of 56

1

View the Exhibit and examine the structure of the CUST table.

Evaluate the following SQL statements executed in the given order:

ALTER TABLE cust

ADD CONSTRAINT cust_id_pk PRIMARY KEY(cust_id) DEFERRABLE INITIALLY DEFERRED;

INSERT INTO cust VALUES (1,'RAJ'); --row 1

INSERT INTO cust VALUES (1,'SAM'); --row 2

COMMIT;

SET CONSTRAINT cust_id_pk IMMEDIATE;

INSERT INTO cust VALUES (1,'LATA'); --row 3

INSERT INTO cust VALUES (2,'KING'); --row 4

COMMIT;

Which rows would be made permanent in the CUST table?

Select one or more of the following:

  • A. row 4 only

  • B. rows 2 and 4

  • C. rows 3 and 4

  • D. rows 1 and 4

Explanation

Question 24 of 56

1

View the Exhibit and examine the structure of the ORDERS table:

The ORDER_ID column has the PRIMARY KEY constraint and CUSTOMER_ID has the NOT

NULL constraint.

Evaluate the following statement:

INSERT INTO (SELECT order_id,order_date,customer_id

FROM ORDERS

WHERE order_total = 1000

WITH CHECK OPTION)

VALUES (13, SYSDATE, 101);

What would be the outcome of the above INSERT statement?

Select one or more of the following:

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

  • D. 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.

Explanation

Question 25 of 56

1

View the Exhibit and examine the description of the EMPLOYEES table.
Your company wants to give 5% bonus to all the employees on their annual salary. The SALARY

column stores the monthly salary for an employee. To check the total for annual salary and bonus

amount for each employee, you issued the following SQL statement:

SELECT first_name, salary, salary*12+salary*12*.05 "ANNUAL SALARY + BONUS"

FROM employees;

Which statement is true regarding the above query?

Select one or more of the following:

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

Explanation

Question 26 of 56

1

Which statement is true regarding external tables?

Select one or more of the following:

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

Explanation

Question 27 of 56

1

View 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, if

the product is purchased today. The products that have no warranty should be displayed at the

top and the products with maximum warranty period should be displayed at the bottom.

Which SQL statement would you execute to fulfill this requirement?

Select one or more of the following:

  • 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;

Explanation

Question 28 of 56

1

Which two statements are true regarding the EXISTS operator used in the correlated subqueries?

(Choose two.)

Select one or more of the following:

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

Explanation

Question 29 of 56

1

A non-correlated subquery can be defined as ____.

Select one or more of the following:

  • A. a set of sequential queries, all of which must always return a single value

  • B. a set of sequential queries, all of which must return values from the same table

  • C. a SELECT statement that can be embedded in a clause of another SELECT statement only

  • D. 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 query

Explanation

Question 30 of 56

1

You 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 with

3) 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?

Select one or more of the following:

  • A. INTERVAL YEAR TO MONTH

  • B. INTERVAL DAY TO SECOND

  • C. TIMESTAMP WITH TIME ZONE

  • D. TIMESTAMP WITH LOCAL TIME ZONE

Explanation

Question 31 of 56

1

Which statements are true regarding the hierarchical query in Oracle Database 10g? (Choose all

that apply.)

Select one or more of the following:

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

Explanation

Question 32 of 56

1

Which two statements are true regarding views? (Choose two.)

Select one or more of the following:

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

Explanation

Question 33 of 56

1

View 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_items

GROUP BY order_id;

Which statements are true regarding the output of these SQL statements? (Choose all that

apply.)

Select one or more of the following:

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

Explanation

Question 34 of 56

1

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

Evaluate the following SQL statement:

SELECT oi.order_id, product_id, order_date

FROM order_items oi JOIN orders o

USING(order_id);

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

Select one or more of the following:

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

Explanation

Question 35 of 56

1

Evaluate 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?

Select one or more of the following:

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

Explanation

Question 36 of 56

1

Evaluate the following statements:

CREATE TABLE digits

(id NUMBER(2),

description VARCHAR2(15));

INSERT INTO digits VALUES (1,'ONE');

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

INSERT INTO digits VALUES (2,'TWO');

COMMIT;

DELETE FROM digits;

SELECT description FROM digits

VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE;

What would be the outcome of the above query?

Select one or more of the following:

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

Explanation

Question 37 of 56

1

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

Evaluate the following SQL statement:

SELECT order_id, customer_id

FROM orders

WHERE order_date > 'June 30 2001';

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

Select one or more of the following:

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

    double quotation marks.

  • B. It would execute and would return ORDER_ID and CUSTOMER_ID for all records having

    ORDER_DATE greater than 'June 30 2001'.

  • C. It would not execute because 'June 30 2001' in the WHERE condition cannot be converted

    implicitly and needs the use of the TO_DATE conversion function for proper execution.

  • D. It would not execute because 'June 30 2001' in the WHERE condition cannot be converted

    implicitly and needs the use of the TO_CHAR conversion function for proper execution.

Explanation

Question 38 of 56

1

Which statements are correct regarding indexes? (Choose all that apply.)

Select one or more of the following:

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

Explanation

Question 39 of 56

1

View 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_PRICE

as NULL?

Select one or more of the following:

  • A. SELECT COUNT(list_price)

    FROM product_information

    WHERE list_price IS NULL;

  • B. SELECT COUNT(list_price)

    FROM product_information

    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;

Explanation

Question 40 of 56

1

User OE, the owner of the ORDERS table, issues the following command:

GRANT SELECT ,INSERT

ON orders

TO hr

WITH GRANT OPTION;

The user HR issues the following command:

GRANT SELECT

ON oe.orders

TO scott;

Then, OE issues the following command:

REVOKE ALL

ON orders

FROM hr;

Which statement is correct?

Select one or more of the following:

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

Explanation

Question 41 of 56

1

View 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 emp

ADD CONSTRAINT emp_id_pk PRIMARY KEY (emp_id)

USING INDEX emp_id_idx;

Which statement is true regarding the effect of the command?

Select one or more of the following:

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

  • D. The statement produces an error because the USING clause is permitted only in the CREATE

    TABLE command.

Explanation

Question 42 of 56

1

SCOTT 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?

Select one or more of the following:

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

Explanation

Question 43 of 56

1

Which statement best describes the GROUPING function?

Select one or more of the following:

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

Explanation

Question 44 of 56

1

View the Exhibit and examine the structure of ORD and ORD_ITEMS tables.

In the ORD table, the PRIMARY KEY is ORD_NO and in the ORD_ITEMS tables the composite

PRIMARY KEY is (ORD_NO, ITEM_NO).

Which two CREATE INDEX statements are valid? (Choose two.)

Select one or more of the following:

  • 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);

Explanation

Question 45 of 56

1

View 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 as

CUSTOMERS table. CUSTOMERS needs to be updated to reflect the latest information about

the customers.

What is the error in the following MERGE statement?

MERGE INTO customers c

USING customer_vu cv

ON (c.customer_id = cv.customer_id)
WHEN MATCHED THEN

UPDATE SET

c.customer_id = cv.customer_id,

c.cust_name = cv.cust_name,

c.cust_email = cv.cust_email,

c.income_level = cv.income_level

WHEN NOT MATCHED THEN

INSERT VALUES(cv.customer_id,cv.cust_name,cv.cust_email,cv,income_level)

WHERE cv.income_level >100000;

Select one or more of the following:

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

Explanation

Question 46 of 56

1

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

Select one or more of the following:

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

Explanation

Question 47 of 56

1

Given 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?

Select one or more of the following:

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

Explanation

Question 48 of 56

1

Evaluate the following CREATE TABLE command:

CREATE TABLE order_item

(order_id NUMBER(3),

item_id NUMBER(2),

qty NUMBER(4),

CONSTRAINT ord_itm_id_pk

PRIMARY KEY (order_id,item_id)

USING INDEX

(CREATE INDEX ord_itm_idx

ON order_item(order_id,item_id)));

Which statement is true regarding the above SQL statement?

Select one or more of the following:

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

Explanation

Question 49 of 56

1

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

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

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

WITH SELECT employee_id, last_name, salary

FROM employees

WHERE (department_id, salary) = ANY (SELECT *

FROM dept_max)

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

FROM departments d JOIN employees j

ON (d.department_id = j.department_id)

GROUP BY d.department_id);

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

Select one or more of the following:

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

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

    =.

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

    is even created.

  • D. The statement would not execute because the comma is missing between the main query

    block and the query name.

Explanation

Question 50 of 56

1

View the Exhibit and examine the data in the DEPARTMENTS tables.

Evaluate the following SQL statement:

SELECT department_id "DEPT_ID", department_name , 'b'

FROM departments

WHERE department_id=90

UNION

SELECT department_id, department_name DEPT_NAME, 'a'

FROM departments

WHERE department_id=10

Which two ORDER BY clauses can be used to sort the output of the above statement? (Choose

two.)

Select one or more of the following:

  • A. ORDER BY 3;

  • B. ORDER BY 'b';

  • C. ORDER BY DEPT_ID;

  • D. ORDER BY DEPT_NAME;

Explanation

Question 51 of 56

1

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

You want to know the EMPLOYEE_ID and FIRST_NAME of all the records in the EMPLOYEES

table wherein the JOB_ID column has ST_CLERK or ST_MAN values, the DEPARTMENT_ID

column has value 30, and the SALARY column has a value greater than 3,000.

Which SQL statement would get you the desired result?

Select one or more of the following:

  • 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;

Explanation

Question 52 of 56

1

View the Exhibit and examine the structure of the ORDERS table.
The 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 orders

TO hr;

Statement 1 by user HR: SELECT * FROM oe.orders;

Statement 2 by user HR: UPDATE oe.orders

SET order_total= 10000;

Which statement is true regarding the above commands?

Select one or more of the following:

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

Explanation

Question 53 of 56

1

View the Exhibit and examine the structure of the ORDER_ITEMS table.
You need to display the ORDER_ID of the order that has the highest total value among all the

orders in the ORDER_ITEMS table.

Which query would produce the desired output?

Select one or more of the following:

  • A. SELECT order_id

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

    GROUP BY order_id;

  • B. SELECT order_id

    FROM order_items

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

    FROM order_items)

    GROUP BY order_id;

  • C. SELECT order_id

    FROM order_items

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

    FROM order_items

    GROUP BY order_id);

  • D. SELECT order_id

    FROM order_items

    GROUP BY order_id

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

    FROM order_items GROUP BY order_id);

Explanation

Question 54 of 56

1

Which two statements are true about sequences created in a single instance database? (Choose

two.)

Select one or more of the following:

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

Explanation

Question 55 of 56

1

View 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 the

departments where all the employees have managers?
SELECT department_id

FROM departments

____

SELECT department_id

FROM employees

WHERE manager_id IS NULL;

Select one or more of the following:

  • A. UNION

  • B. MINUS

  • C. INTERSECT

  • D. UNION ALL

Explanation

Question 56 of 56

1

Which mandatory clause has to be added to the following statement to successfully create an

external table called EMPDET?

CREATE TABLE empdet

(empno CHAR(2), ename CHAR(5), deptno NUMBER(4))

ORGANIZATION EXTERNAL

(LOCATION ('emp.dat'));

Select one or more of the following:

  • A. TYPE

  • B. REJECT LIMIT

  • C. DEFAULT DIRECTORY

  • D. ACCESS PARAMETERS

Explanation