Oracle Database SQL Expert

QUESTION NO: 1

Which three possible values can be set for the TIME_ZONE session parameter by using the ALTER SESSION command? (Choose three.)

A. 'os'

B. local

C. -8:00'

D. dbtimezone Li

E. 'Australia'

Answer: B,C,D

Explanation:

QUESTION NO: 2

EMPDET 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 ASSELECT* FROM empdept;

D. CREATE INDEX empdet_dx ON empdet(empno);

Answer: C

Explanation:

QUESTION NO: 3

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

A. it can be used to concatenate two strings.

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

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

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

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

Answer: C,D,E

Explanation:

QUESTION NO: 4

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

A. They can accept only one argument.

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

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

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

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

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

Answer: D,E,F

Explanation:

QUESTION NO: 5

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

Evaluate the following SQL statement:

SELECT oi.order_id, product_jd, order_date

FROM order_items oi JOIN orders o

USING(order_id);

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

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

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

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

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

Answer: D

Explanation:

QUESTION NO: 6

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

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

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

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

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

Answer: A,D

Explanation:

QUESTION NO: 7

Evaluate the CREATE TABLE statement:

CREATE TABLE products

(product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY,

product_name VARCHAR2(15));

Which statement is true regarding the PROD_ID_PK constraint?

A. 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 nonunique index.

D. It would be created and remains in a disabled state because no index is specified in the command.

Answer: B

Explanation:

QUESTION NO: 8

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

B. displaying all supplier IDs whose average list price is more than 500

C. displaying the number of products whose list prices are more than the average list price

D. displaying all the products whose minimum list prices are more than the average list price of products having the product status orderable

E. displaying the total number of products supplied by supplier 102071 and having product status OBSOLETE

Answer: C,D

Explanation:

QUESTION NO: 9

Which 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: C

QUESTION NO: 10

Evaluate the following statement:

INSERT ALL

WHEN order_total < 10000 THEN

INTO small_orders

WHEN order_total > 10000 AND order_total < 20000 THEN

INTO medium_orders

WHEN order_total > 2000000 THEN

INTO large_orders

SELECT order_id, order_total, customer_id

FROM orders;

Which statement is true regarding the evaluation of rows returned by the subquery in the INSERT statement?

A. They are evaluated by all the three WHEN clauses regardless of the results of the evaluation of any other WHEN clause.

B. They are evaluated by the first WHEN clause. If the condition is true, then the row would be evaluated by the subsequent WHEN clauses.

C. They are evaluated by the first WHEN clause. If the condition is false, then the row would be evaluated by the subsequent WHEN clauses.

D. The INSERT statement would give an error because the ELSE clause is not present for support in case none of the WHEN clauses are true.

Answer: A

Explanation:

QUESTION NO: 11

View the Exhibit and examine the data in ORDERS_MASTER and MONTHLYjDRDERS tables.

Evaluate the following MERGE statement:

MERGE INTO orders_master o

USING monthly_orders m

ON (o.order_id = m.order_id)

WHEN MATCHED THEN

UPDATE SET o.order_total = m.order_total

DELETE WHERE (m.order_total IS NULL)

WHEN NOT MATCHED THEN

INSERT VALUES (m.order_id, m.order_total);

What would be the outcome of the above statement?

A. The ORDERS_MASTER table would contain the ORDERJDs 1 and 2.

B. The ORDERS_MASTER table would contain the ORDERJDs 1,2 and 3.

C. The ORDERS_MASTER table would contain the ORDERJDs 1,2 and 4.

D. The ORDERS MASTER table would contain the ORDER IDs 1,2,3 and 4.

Answer: C

Explanation:

QUESTION NO: 12

The user SCOTT who is the owner of ORDERS and ORDERJTEMS tables issues the following GRANT command:

GRANT ALL

ON orders, order_items

TO 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 ORDERJTEMS tables.

Answer: D

Explanation:

QUESTION NO: 13

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?

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.

Answer: B

Explanation:

QUESTION NO: 14

Which 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,E

Explanation:

QUESTION NO: 15

Which 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: D

Explanation:

QUESTION NO: 16

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

CREATE TABLE emp

(emp_no NUMBER(2) CONSTRAINT emp_emp_no_pk PRIMARY KEY,

enameVARCHAR2(15),

salary NUMBER(8,2),

mgr_no NUMBER(2) CONSTRAINT emp_mgr_fk REFERENCES emp);

ALTER TABLE emp

DISABLE CONSTRAINT emp_emp_no_pk CASCADE;

ALTER TABLE emp

ENABLE CONSTRAINT emp_emp_no_pk;

What would be the status of the foreign key EMP_MGR_FK?

A. It would be automatically enabled and deferred.

B. It would be automatically enabled and immediate.

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

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

Answer: C

Explanation:

QUESTION NO: 17

Which 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,D

Explanation:

QUESTION NO: 18

View the Exhibit and examine the structure of the ORDERS table. Which task would require subqueries?

A. displaying the total order value for sales representatives 161 and 163

B. displaying the order total for sales representative 161 in the year 1999

C. displaying the number of orders that have order mode online and order date in 1999

D. displaying the number of orders whose order total is more than the average order total for all online orders

Answer: D

Explanation:

QUESTION NO: 19

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

Evaluate the following SQL statement:

SELECT phone_number,

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

"PHONE NUMBER"

FROM employees;

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

A. xxx-xxx-xxxx

B. (xxx) xxxxxxx

C. (xxx) xxx-xxxx

D. xxx-(xxx)-xxxx

Answer: C

Explanation:

QUESTION NO: 20

The details of the order ID, order date, order total, and customer ID are obtained from the ORDERS table. If the order value is more than 30000, the details have to be added to the LARGEjDRDERS table. The order ID, order date, and order total should be added to the ORDERJHISTORY table, and order ID and customer ID should be added to the CUSTJHISTORY table. Which multitable INSERT statement would you use?

A. Pivoting INSERT

B. Unconditional INSERT

C. Conditional ALL INSERT

D. Conditional FIRST INSERT

Answer: C

Explanation:

QUESTION NO: 21

View the Exhibit and examine the data in the LOCATIONS table.

Evaluate the following SOL statement:

SELECT street_address

FROM locations

WHERE

REGEXP_INSTR(street_address,'[^[: alpha:]]’) = 1;

Which statement is true regarding the output of this SOL 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: D

Explanation:

QUESTION NO: 22

Which statement is true regarding the ROLLUP operator specified in the GROUP BY clause of a SQL 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: C

Explanation:

QUESTION NO: 23

View the Exhibit and examine the data in the CUST_DET table.

You executed the following multitable INSERT statement:

INSERT FIRST

WHEN credit_limit >= 5000 THEN

INTO cust_1 VALUES(cust_id, credit_limit, grade, gender)

WHEN grade = THE

INTO cust_2 VALUES(cust_id, credit_limit, grade, gender)

WHEN gender = THE

INTO cust_3 VALUES(cust_id, credit_limit, grade, gender)

INTO cust_4 VALUES(cust_id, credit_limit, grade, gender)

ELSE

INTO 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 satisfied

B. CUST_1 and CUST_2 tables because CREDIT_LIMIT and GRADE conditions are satisfied

C. CUST_1 ,CUST_2 and CUST_5 tables because CREDIT_LIMIT and GRADE conditions are satisfied but GENDER condition is not satisfied

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

Answer: A

Explanation:

QUESTION NO: 24

You executed the following SQL statements in the given order:

CREATE TABLE orders

(order_id NUMBER(3) PRIMARY KEY,

order_date DATE,

customer_id number(3));

INSERT INTO orders VALUES (100,'10-mar-2007,,222);

ALTER TABLE orders MODIFY order_date NOT NULL;

UPDATE orders SET customer_id=333;

DELETE FROM order;

The DELETE statement results in the following error:

ERROR at line 1:

ORA-00942: table or view does not exist

What would be the outcome?

A. All the statements before the DELETE statement would be rolled back.

B. All the statements before the DELETE statement would be implicitly committed within the session.

C. All the statements up to the ALTER TABLE statement would be committed and the outcome of UPDATE statement would be rolled back.

D. All the statements up to the ALTER TABLE statement would be committed and the outcome of the UPDATE statement is retained uncommitted within the session.

Answer: D

Explanation:

QUESTION NO: 25

Evaluate the following statements:

CREATE TABLE digits

(id NUMBER(2),

description VARCHAR2(15));

INSERT INTO digits VALUES (1,'ONE);

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

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

COMMIT;

DELETE FROM digits;

SELECT description FROM digits

VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE;

What would be the outcome of the above query?

A. 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: C

Explanation:

QUESTION NO: 26

A non-correlated subquery can be defined as________ .

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

Answer: D

Explanation:

QUESTION NO: 27

View the Exhibit and examine the data in ORDERS_MASTER and MONTHLY_ORDERS tables.

Evaluate the following MERGE statement:

MERGE INTO orders_master o

USING monthly_orders m

ON (o.order_id = m.order_id)

WHEN MATCHED THEN

UPDATE SET o.order_total = m.order_total

DELETE WHERE (m.order_total IS NULL)

WHEN NOT MATCHED THEN

INSERT 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: C

Explanation:

QUESTION NO: 28

Which 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) , 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: D

Explanation:

QUESTION NO: 29

Evaluate the following CREATE SEQUENCE statement:

CREATE SEQUENCE seql

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 seql.nextval FROM dual;

What is displayed by the SELECT statement?

A. 1

B. 10

C. 100

D. an error

Answer: A

Explanation:

QUESTION NO: 30

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

The 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) GRPJOB,

GROUPING(d. location_id) GRP_LOC

FROM employees e JOIN departments d

ON e.department_id = d.department_id

GROUP 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 GRPJOB 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 GRPJOB and GRP_LOC means that the NULL value in JOBJD and LOCATIONJD columns are taken into account to generate the subtotal.

D. The value 0 in GRP_DEPT, GRPJOB, and GRP_LOC means that DEPARTMENT_ID, JOB_ID, and LOCATION_ID columns are taken into account to generate the subtotal

Answer: B,D

Explanation:

QUESTION NO: 31

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

You want to display the EMPLOYEE_ID, LAST_NAME, and SALARY for the employees who get the maximum salary in their respective departments. The following SQL statement was written:

WITH

SELECT employee_id, last_name, salary

FROM employees

WHERE (department_id, salary) = ANY (SELECT*

FROM dept_max)

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

FROM departments d JOIN employees j

ON (d. department_id = j. department_id)

GROUP BY d. department_id);

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

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

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

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

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

Answer: C

Explanation:

QUESTION NO: 32

Which 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: C

Explanation:

QUESTION NO: 33

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

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

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

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

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

Answer: A,C

Explanation:

QUESTION NO: 34

Which two statements are true regarding multiple-row subqueries? (Choose two.)

A. 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,E

Explanation:

QUESTION NO: 35

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?

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: C

Explanation:

QUESTION NO: 36

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?

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: D

Explanation:

QUESTION NO: 37

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

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

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

A. 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,D

Explanation:

QUESTION NO: 38

Evaluate the following expression using meta character for regular expression:

'[AAle|ax.r$]'

Which two matches would be returned by this expression? (Choose two.)

A. Alex

B. Alax

C. Alxer

D. Alaxendar

E. Alexender

Answer: D,E

Explanation:

QUESTION NO: 39

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

A. ORDER BY 3;

B. ORDER BY 'b';

C. ORDER BY DEPT_ID;

D. ORDER BY DEPT NAME;

Answer: A,C

Explanation:

QUESTION NO: 40

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

Evaluate the following SQL statements:

Statement 1:

SELECT employee_id, last_name, job_id, manager_id FROM employees START WITH employee_id = 101

CONNECT BY PRIOR employee_id = manager_id AND manager_id != 108;

Statement 2:

SELECT employee_id, last_name, job_id, manager_id

FROM employees

WHERE manager_id != 108

START WITH employee_id = 101

CONNECT BY PRIOR employee_id = manager_id;

Which two statements are true regarding the above SQL statements? (Choose two.)

A. Statement 2 would not execute because the WHERE clause condition is not allowed in a statement that has the START WITH clause.

B. The output for statement 1 would display the employee with MANAGERJD 108 and all the employees below him or her in the hierarchy.

C. The output of statement 1 would neither display the employee with MANAGERJD 108 nor any employee below him or her in the hierarchy.

D. The output for statement 2 would not display the employee with MANAGERJD 108 but it would display all the employees below him or her in the hierarchy.

Answer: C,D

Explanation:

Site Search:

Close

Close
Download Free Demo of VCE
Exam Simulator

Experience Avanset VCE Exam Simulator for yourself.


Simply submit your e-mail address below to get started with our interactive software demo of your free trial.


Enter Your Email Address

Free Demo Limits: In the demo version you will be able to access only first 5 questions from exam.