1Z0-071 Premium Bundle

1Z0-071 Premium Bundle

Oracle Database 12c SQL Certification Exam

4.5 
(17685 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
November 5, 2024Last update

Oracle 1Z0-071 Free Practice Questions

Q1. Which three statements are true reading subquenes?

A. A Main query can have many subqueries.

B. A subquery can have more than one main query

C. The subquery and main query must retrieve date from the same table.

D. The subquery and main query can retrieve data from different tables.

E. Only one column or expression can be compared between the subquery and main query.

F. Multiple columns or expressions can be compared between the subquery and main query.

Answer: A,D,F

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

Q3. Which two statements are true regarding the GROUP BY clause in a SQL statement? (Choose two.)

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

Q4. Evaluate the following two queries:

Which statement is true regarding the above two queries?

A. Performance would improve query 2 only if there are null values in the CUST CREDIT LIMIT column.

B. There would be no change in performance.

C. Performance would degrade in query 2.

D. Performance would improve in query 2.

Answer: B

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

Q6. Examine the following query:

What is the output of this query?

A. It displays 5 percent of the products with the highest amount sold.

B. It displays the first 5 percent of the rows from the SALES table.

C. It displays 5 percent of the products with the lowest amount sold.

D. It results in an error because the ORDER BY clause should be the last clause.

Answer: C

Q7. Which three tasks can be performed using SQL functions built into Oracle Database? (Choose three.)

A. Combining more than two columns or expressions into a single column in the output

B. Displaying a date in a nondefault format

C. Substituting a character string in a text expression with a specified string

D. Finding the number of characters in an expression

Answer: B,C,D

Q8. Examine the structure of the employees table.

There is a parent/child relationship betweenEMPLOYEE_IDandMANAGER_ID.

You want to display the last names and manager IDs of employees who work for the same manager asthe employee whoseEMPLOYEE_ID123.

Which query provides the correct output? 

A)

B)

C)

D)

A. Option A

B. Option B

C. Option C

D. Option D

Answer: B

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

Q10. Evaluate the following SQL statement:

SQL> SELECT cust_id, cust_last_name "Last Name" FROM customers

WHERE country_id = 10 UNION

SELECT cust_id CUST_NO, cust_last_name FROM customers

WHERE country_id = 30;

Which ORDER BY clause are valid for the above query? (Choose all that apply.)

A. ORDER BY 2,1

B. ORDER BY CUST_NO

C. ORDER BY 2,cust_id

D. ORDER BY "CUST_NO"

E. ORDER BY "Last Name"

Answer: A,C,E

Explanation:

Using the ORDER BY Clause in Set Operations

- The ORDER BY clause can appear only once at the end of the compound query.

- Component queries cannot have individual ORDER BY clauses.

- The ORDER BY clause recognizes only the columns of the first SELECT query.

- By default, the first column of the first SELECT query is used to sort the output in an ascending order.

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

Q12. You execute the following commands:

For which substitution variables are you prompted for the input?

A. None, because no input required

B. Both the substitution variables 'hiredate' and 'mgr_id\

C. Only 'hiredate'

D. Only 'mgr_id'

Answer: B

Q13. Which 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 dictionary

Answer: C,D,F

Q14. You issue the following command to drop the PRODUCTS table: SQL>DROP TABLE products;

What is the implication of this command? (Choose all that apply.)

A. All data in the table are deleted but the table structure will remain

B. All data along with the table structure is deleted

C. All viewsand synonyms will remain but they are invalidated

D. The pending transaction in the session is committed

E. All indexes on the table will remain but they are invalidated

Answer: B,C,D

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

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

You want to display all employees and their managers having 100 as the MANAGER_ID. You want the output in two columns: the first column would have the LAST_NAME of the managers and 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: B

Q17. You are designing the structure of a table in which two columns have the specifications:

COMPONENT_ID - must be able to contain a maximum of 12 alphanumeric characters and uniquely identify the row

EXECUTION_DATETIME - contains Century, Year, Month, Day, Hour, Minute, Second to the maximum precision and is used for calculations and comparisons between components.

Which two options define the data types that satisfy these requirements most efficiently?

A. The EXECUTION_DATETIME must be of INTERVAL DAY TO SECOND data type.

B. The EXECUTION _DATETIME must be of TIMESTAMP data type.

C. The EXECUTION_DATATIME must be of DATE data type.

D. The COMPONENT_ID must be of ROWID data type.

E. The COMPONENT_ID must be of VARCHAR2 data type.

F. The COMPONENT_ID column must be of CHAR data type.

Answer: C,E

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

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

A. CURRVAL is used to refer to the last sequence number that has been generated

B. DELETE <sequencename> would remove a sequence from the database

C. The numbers generated by a sequence can be used only for one table

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

Explanation:

Gaps in the Sequence

Although sequence generators issue sequential numbers without gaps, this action occurs independent of a commit or rollback. Therefore, if you roll back a statement containing a sequence, the number is lost.

Another event that can cause gaps in the sequence is a system crash. If the sequence caches values in memory, those values are lost if the system crashes.

Because sequences are not tied directly to tables, the same sequence can be used for multiple tables.

However, if you do so, each table can contain gaps in the sequential numbers.

Modifying a Sequence

If you reach the MAXVALUE limit for your sequence, no additional values from the sequence are allocated and you will receive an error indicating that the sequence exceeds the MAXVALUE. To continue to use the sequence, you can modify it by using the ALTER SEQUENCE statement

To remove a sequence, use the DROP statement:

DROP SEQUENCE dept_deptid_seq;

Q20. Which three statements are true regarding the data types?

A. Only one LONG column can be used per table.

B. ATIMESTAMP data type column stores only time values with fractional seconds.

C. The BLOB data type column is used to store binary data in an operating system file.

D. The minimum column width that can be specified for a varchar2 data type column is one.

E. The value for a CHAR data type column is blank-padded to the maximum defined column width.

Answer: A,D,E

Q21. Evaluate the following ALTER TABLE statement:

ALTER TABLE orders SET 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: D

Q22. See the Exhibit and Examine the structure of the CUSTOMERS table:

Using the CUSTOMERS table, you need to generate a report that shows an increase in the credit limit by 15% for all customers. Customers whose credit limit has not been entered should have the message "Not Available" displayed.

Which SQL statement would produce the required result?

A. SELECT NVL(cust_credit_limit,'Not Available')*.15 "NEW CREDIT" FROM customers;

B. SELECT NVL(cust_credit_limit*.15,'Not Available') "NEW CREDIT" FROM customers;

C. SELECT TO_CHAR(NVL(cust_credit_limit*.15,'Not Available')) "NEW CREDIT" FROM customers;

D. SELECT NVL(TO_CHAR(cust_credit_limit*.15),'Not Available') "NEW CREDIT" FROM customers;

Answer:

Explanation: NVL Function

Converts a null value to an actual value:

Data types that can be used are date, character, and number. Data types must match:

– NVL(commission_pct,0)

– NVL(hire_date,'01-JAN-97')

– NVL(job_id,'No Job Yet')

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

START 1Z0-071 EXAM