1Z0-071 Sample Questions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8
At a glance
Powered by AI
The document discusses SQL questions and answers related to Oracle database concepts such as data manipulation, queries, views and privileges. Key topics covered include the WHERE and HAVING clauses, correlated subqueries, and granting privileges.

The WHERE clause is used to filter rows before grouping, while the HAVING clause is used to filter groups after grouping. Aggregate functions and columns in the HAVING clause must be in the SELECT list.

The steps are: 2) Fetch the candidate row from the outer query, 4) Return rows from the inner query using the candidate row value, 1) Evaluate the WHERE clause of the outer query, 3) Repeat for all rows of the outer query table.

Oracle

1Z0-071

Oracle Database 12c SQL

Download Full Version : http://killexams.com/pass4sure/exam-detail/1Z0-071


QUESTION: 64
Which task can be performed by using a single Data Manipulation Language
(OML) statement?

A. adding a column constraint when inserting a row into a table


B. adding a column with a default value when inserting a row into a table
C. removing all data only from one single column on which a unique constraint is
defined
D. removing all data only from one single column on which a primary key
constraint is defined

Answer: D

QUESTION: 65
Which statements are true regarding the WHERE and HAVING clauses in a
SELECT statement? (Choose all that apply.)

A. The HAVING clause can be used with aggregate functions in subqueries.


B. The WHERE clause can be used to exclude rows after dividing them into
groups.
C. The WHERE clause can be used to exclude rows before dividing them into
groups.
D. The aggregate functions and columns used in the HAVING clause must be
specified in the SELECT list of the query.
E. The WHERE and HAVING clauses can be used in the same statement only if
they are applied to different columns in the table.

Answer: A, C

QUESTION: 66

Which statement is true regarding the INTERSECT operator?

A. It ignores NULL values


B. The number of columns and data types must be identical for all SELECT
statements in the query
C. The names of columns in all SELECT statements must be identical
D. Reversing the order of the intersected tables the result

Answer: B
Explanation:
INTERSECT Returns only the rows that occur in both queries’ result sets, sorting
them and removing duplicates. The columns in the queries that make up a
compound query can have different names, but the output result set will use the
names of the columns in the first query.

QUESTION: 67
View the Exhibit and examine the ORDERS table. The ORDERS table contains
data and all orders have been assigned a customer ID. Which statement 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;

Answer: B

QUESTION: 68

Examine thestructure of the BOOKS_TRANSACTIONS table:

You want to display the member IDs, due date, and late fee as $2 for all
transactions. Which SQL statement must you execute?
A)
Exhibit

B)
Exhibit

C)
Exhibit

D)
Exhibit

A. Option A
B. Option B
C. Option C
D. Option D

Answer: C

QUESTION: 69
View 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
DELETE CASCADE option.
Which DELETE statement would execute successfully?

A. DELETE order_id FROM orders

WHERE order_total < 1000;

B. 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: B

QUESTION: 70
You want to display 5 percent of the rows from the sales table for products with
the lowestAMOUNT_SOLD and also want to include the rows that have the
sameAMOUNT_SOLDeven if this causes the output to exceed 5 percent of the
rows. Which query willprovide the required result?

A. SELECT prod_id, cust_id, amount_sold FROM sales


ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS WITH TIES;
B. SELECT prod_id, cust_id, amount_sold FROM sales
ORDER BY amount_sold
FETCH FIRST 5 PERCENT ROWS ONLY WITH TIES;
C. SELECT prod_ id, cust_id, amount_sold FROM sales
ORDER BY araount_sold
FETCH FIRST 5 PERCENT ROWS WITH TIES ONLY;
D. SELECT prod_id, cust_id, amount_sold FROM sales
ORDER BY amount sold
FETCH FIRST 5 PERCENT ROWS ONLY;
Answer: B

QUESTION: 71

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

A. 4,2,1,3
B. 4,1,2,3
C. 2,4,1,3
D. 2,1,4,3

Answer: C

QUESTION: 72

Which statement correctly grants a system privilege?

A. GRANT EXECUTE ON prod TO PUBLIC;


B. GRANT CREATE VIEW ON tablel TO used;
C. GRANT CREATE TABLE TO used ,user2;
D. GRANT CREATE SESSION TO ALL;

Answer: C

QUESTION: 73

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?

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)ll’ 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: B
For More exams visit http://killexams.com
­

Kill your exam at First Attempt....Guaranteed!

You might also like