1Z0-061 Premium Bundle

1Z0-061 Premium Bundle

Oracle Database 12c SQL Fundamentals Certification Exam

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

Oracle 1Z0-061 Free Practice Questions

Q1. View the Exhibit and examine the structures of the employees and departments tables. 

You want to update the employees table as follows: 

-Update only those employees who work in Boston or Seattle (locations 2900 and 2700). 

-Set department_id for these employees to the department_id corresponding to London (location_id 2100). 

-Set the employees' salary in iocation_id 2100 to 1.1 times the average salary of their department. 

-Set the employees' commission in iocation_id 2100 to 1.5 times the average commission of their department. 

You issue the following command: 

What is the outcome? 

A. It executes successfully and gives the correct result. 

B. It executes successfully but does not give the correct result. 

C. It generates an error because a subquery cannot have a join condition in an update statement. 

D. It generates an error because multiple columns (SALARY, COMMISSION) cannot be specified together in an update statement. 

Answer:

Q2. Which create table statement is valid? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: 

PRIMARY KEY Constraint A PRIMARY KEY constraint creates a primary key for the table. Only one primary key can be created for each table. The PRIMARY KEY constraint is a column or a set of columns that uniquely identifies each row in a table. This constraint enforces the uniqueness of the column or column combination and ensures that no column that is part of the primary key can contain a null value. Note: Because uniqueness is part of the primary key constraint definition, the Oracle server enforces the uniqueness by implicitly creating a unique index on the primary key column or columns. 

Q3. You need to display the first names of all customers from the customers table that contain the character 'e' and have the character 'a' in the second last position. 

Which query would give the required output? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: 

The SUBSTR(string, start position, number of characters) function accepts three parameters and returns a string consisting of the number of characters extracted from the source string, beginning at the specified start position: 

substr('http://www.domain.com', 12, 6) = domain 

The position at which the first character of the returned string begins. 

When position is 0 (zero), then it is treated as 1. 

When position is positive, then the function counts from the beginning of string to find the first character. 

When position is negative, then the function counts backward from the end of string. substring_length 

The length of the returned string. SUBSTR calculates lengths using characters as defined by the input character set. SUBSTRB uses bytes instead of characters. SUBSTRC uses 

Unicode complete characters. 

SUBSTR2 uses UCS2 code points. SUBSTR4 uses UCS4 code points. 

When you do not specify a value for this argument, then the function 

The INSTR(source string, search item, [start position], [nth occurrence of search item]) function returns a number that represents the position in the source string, beginning from the given start position, where the nth occurrence of the search item begins: 

instr('http://www.domain.com', '.', 1, 2) = 18 

Q4. Examine the data in the ename and hiredate columns of the employees table: 

You want to generate a list of user IDs as follows: You issue the following query: 

What is the outcome? 

A. It executes successfully and gives the correct output. 

B. It executes successfully but does not give the correct output. 

C. It generates an error because the REPLACE function is not valid. 

D. It generates an error because the SUBSTR function cannot be nested in the CONCAT function. 

Answer:

Explanation: 

REPLACE (text, search_string, replacement_string) Searches a text expression for a character string and, if found, replaces it with a specified replacement string The REPLACE Function The REPLACE function replaces all occurrences of a search item in a source string with a replacement term and returns the modified source string. If the length of the replacement term is different from that of the search item, then the lengths of the returned and source strings will be different. If the search string is not found, the source string is returned unchanged. Numeric and date literals and expressions are evaluated before being implicitly cast as characters when they occur as parameters to the REPLACE function. The REPLACE function takes three parameters, with the first two being mandatory. Its syntax is REPLACE (source string, search item, [replacement term]). If the replacement term parameter is omitted, each occurrence of the search item is removed from the source string. In other words, the search item is replaced by an empty string. . The following queries illustrate the REPLACE function with numeric and date expressions: Query 1: select replace(10000-3, '9', '85') from dual Query 2: select replace(sysdate, 'DEC', 'NOV') from dual 

Q5. View the Exhibits and examine products and sales tables. 

You issue the following query to display product name and the number of times the product has been sold: 

What happens when the above statement is executed? 

A. The statement executes successfully and produces the required output. 

B. The statement produces an error because item_cnt cannot be displayed in the outer query. 

C. The statement produces an error because a subquery in the from clause and outer-joins cannot be used together. 

D. The statement produces an error because the group by clause cannot be used in a subquery in the from clause. 

Answer:

Q6. Using the customers table, you need to generate a report that shows 50% of each credit amount in each income level. The report should NOT show any repeated credit amounts in each income level. 

Which query would give the required result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: Duplicate Rows Unless you indicate otherwise, SQL displays the results of a query without eliminating the duplicate rows. 

To eliminate duplicate rows in the result, include the DISTINCT keyword in the SELECT clause immediately after the SELECT keyword. 

You can specify multiple columns after the DISTINCT qualifier. The DISTINCT qualifier affects all the selected columns, and the result is every distinct combination of the columns. 

Q7. Which statement adds a column called salary to the employees table having 100 rows, which cannot contain null? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Reference: http://www.comp.nus.edu.sg/~ooibc/courses/sql/ddl_table.htm (see changing table structures) 

Q8. You want to create a sales table with the following column specifications and data types: 

SALESID: Number STOREID: Number ITEMID: Number QTY: Number, should be set to 1 when no value is specified SLSDATE: Date, should be set to current date when no value is specified PAYMENT: Characters up to 30 characters, should be set to CASH when no value is specified 

Which statement would create the table? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q9. Examine the structure of the customers table: 

CUSTNO is the primary key in the table. You want to find out if any customers' details have been entered more than once using different CUSTNO, by listing all the duplicate names. 

Which two methods can you use to get the required result? 

A. Self-join 

B. Subquery 

C. Full outer-join with self-join 

D. Left outer-join with self-join 

E. Right outer-join with self-join 

Answer: A,B 

Q10. Examine the data in the ORD_ITEMS table: 

Evaluate the following query: 

Which statement is true regarding the outcome of the above query? 

A. It gives an error because the having clause should be specified after the group by clause. 

B. It gives an error because all the aggregate functions used in the having clause must be specified in the select list. 

C. It displays the item nos with their average quantity where the average quantity is more than double the minimum quantity of that item in the table. 

D. It displays the item nos with their average quantity where the average quantity is more than double the overall minimum quantity of all the items in the table. 

Answer:

Q11. Examine the structure of the employees table. 

You want to display the maximum and minimum salaries of employees hired 1 year ago. Which two statements would get the correct output? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: B,D 

Explanation: 

http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z1 0.doc.sqlref%2Fsrc%2Ftpc%2Fdb2z_sql_subselectexamples.htm.

Q12. In the customers table, the CUST_CITY column contains the value 'Paris' for the CUST_FIRST_NAME 'Abigail'. 

Evaluate the following query: 

What would be the outcome? 

A. Abigail PA 

B. Abigail Pa 

C. Abigail IS 

D. An error message 

Answer:

Q13. Which two statements are true regarding constraints? 

A. A foreign key cannot contain null values. 

B. A column with the unique constraint can contain null values. 

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 constraints can be defined at the column level as well as the table level. 

Answer: B,D 

Q14. View the Exhibit and examine the structure of the promotions table. 

Evaluate the following SQL statement: 

Which statement is true regarding the outcome of the above query? 

A. It shows COST_REMARK for all the promos in the table. 

B. It produces an error because the SUBQUERY gives an error. 

C. It shows COST_REMARK for all the promos in the promo category 'TV' 

D. It produces an error because SUBQUERIES cannot be used with the case expression. 

Answer:

Q15. Evaluate the following query: 

SQL> SELECT TRUNC(ROUND(156.00, -1), -1) 

FROM DUAL; 

What would be the outcome? 

A. 16 

B. 100 

C. 160 

D. 200 

E. 150 

Answer:

Explanation: 

Function Purpose ROUND(column|expression, n) Rounds the column, expression, or value to n decimal places or, if n is omitted, no decimal places (If n is negative, numbers to the left of decimal point are rounded.) TRUNC(column|expression, n) Truncates the column, expression, or value to n decimal places or, if n is omitted, n defaults to zero 

START 1Z0-061 EXAM