1Z0-061 Premium Bundle

1Z0-061 Premium Bundle

Oracle Database 12c SQL Fundamentals Certification Exam

4.5 
(24150 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
May 20, 2024Last update

Oracle 1Z0-061 Free Practice Questions

Q1. Examine the structure of the transactions table: 

You want to display the date, time, and transaction amount of transactions that where done before 12 noon. The value zero should be displayed for transactions where the transaction amount has not been entered. 

Which query gives the required result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q2. Examine the structure of the orders table: 

You want to find the total value of all the orders for each year and issue the following command: 

Which statement is true regarding the outcome? 

A. It executes successfully and gives the correct output. 

B. It gives an error because the TO_CHAR function is not valid. 

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

D. It gives an error because the data type conversion in the SELECT list does not match the data type conversion in the GROUP BY clause. 

Answer:

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

Q4. You issue the following command to drop the products table: 

SQL> DROP TABLE products; 

Which three statements are true about the implication of this command? 

A. All data along with the table structure is deleted. 

B. A pending transaction in the session is committed. 

C. All indexes on the table remain but they are invalidated. 

D. All views and synonyms remain but they are invalidated. 

E. All data in the table is deleted but the table structure remains. 

Answer: A,B,D 

Q5. Which two statements are true regarding single row functions? 

A. MOD: returns the quotient of a division B. TRUNC: can be used with number and date values 

C. CONCAT: can be used to combine any number of values 

D. SYSDATE: returns the database server current date and time 

E. INSTR: can be used to find only the first occurrence of a character in a string 

F. TRIM: can be used to remove all the occurrences of a character from a string 

Answer: B,D 

Explanation: 

ROUND: Rounds value to a specified decimal TRUNC: Truncates value to a specified decimal MOD: Returns remainder of division SYSDATE is a date function that returns the current database server date and time. 

Date-Manipulation Functions Date functions operate on Oracle dates. All date functions return a value of the DATE data type except MONTHS_BETWEEN, which returns a numeric value. MONTHS_BETWEEN(date1, date2): Finds the number of months between date1 and date2. The result can be positive or negative. If date1 is later than date2, the result is positive; if date1 is earlier than date2, the result is negative. The noninteger part of the result represents a portion of the month. ADD_MONTHS(date, n): Adds n number of calendar months to date. The value of n must be an integer and can be negative. NEXT_DAY(date, 'char'): Finds the date of the next specified day of the week ('char') following date. The value of char may be a number representing a day or a character string. LAST_DAY(date): Finds the date of the last day of the month that contains date The above list is a subset of the available date functions. ROUND and TRUNC number functions can also be used to manipulate the date values as shown below: ROUND(date[, 'fmt']): Returns date rounded to the unit that is specified by the format model fmt. If the format model fmt is omitted, date is rounded to the nearest day. TRUNC(date[, 'fmt']): Returns date with the time portion of the day truncated to the unit that is specified by the format model fmt. If the format model fmt is omitted, date is truncated to the nearest day. 

The CONCAT Function The CONCAT function joins two character literals, columns, or expressions to yield one larger character expression. Numeric and date literals are implicitly cast as characters when they occur as parameters to the CONCAT function. Numeric or date expressions are evaluated before being converted to strings ready to be concatenated. The CONCAT function takes two parameters. Its syntax is CONCAT(s1, s2), where s1 and s2 represent string literals, character column values, or expressions resulting in character values. 

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 

The TRIM function literally trims off leading or trailing (or both) character strings from a 

given source string: 

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

Q7. View the Exhibit and examine the structure of the product, component, and PDT_COMP tables. 

In product table, PDTNO is the primary key. 

In component table, COMPNO is the primary key. 

In PDT_COMP table, <PDTNO, COMPNO) is the primary key, PDTNO is the foreign key referencing PDTNO in product table and COMPNO is the foreign key referencing the COMPNO in component table. 

You want to generate a report listing the product names and their corresponding component names, if the component names and product names exist. 

Evaluate the following query: 

SQL>SELECT pdtno, pdtname, compno, compname 

FROM product _____________ pdt_comp 

USING (pdtno) ____________ component USING (compno) 

WHERE compname IS NOT NULL; 

Which combination of joins used in the blanks in the above query gives the correct output? 

A. JOIN; JOIN 

B. FULL OUTER JOIN; FULL OUTER JOIN 

C. RIGHT OUTER JOIN; LEFT OUTER JOIN 

D. LEFT OUTER JOIN; RIGHT OUTER JOIN 

Answer:

Q8. Examine the data in the CUST_NAME column of the customers table. 

You need to display customers' second names where the second name starts with "Mc" or "MC." 

Which query gives the required output? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q9. View the Exhibits and examine the structures of the products, sales, and customers tables. 

You need to generate a report that gives details of the customer's last name, name of the product, and the quantity sold for a customers in 'Tokyo'. 

Which two queries give the required result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: A,C 

Q10. You need to list the employees in DEPARTMENT_ID 30 in a single row, ordered by HIRE_DATE. 

Examine the sample output: 

Which query will provide the required output? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Reference: http://docs.oracle.com/cd/E11882_01/server.112/e10592/functions089.htm 

Q11. View the Exhibit and examine the data in the costs table. 

You need to generate a report that displays the IDs of all products in the costs table whose unit price is at least 25% more than the unit cost. The details should be displayed in the descending order of 25% of the unit cost. You issue the following query: 

Which statement is true regarding the above query? 

A. It executes and produces the required result. 

B. It produces an error because an expression cannot be used in the order by clause. 

C. It produces an error because the DESC option cannot be used with an expression in the order by clause. 

D. It produces an error because the expression in the ORDER by clause should also be specified in the SELECT clause. 

Answer:

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

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

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

Q15. You issue the following command to alter the country column in the departments table: Which statement is true? 

A. It produces an error because column definitions cannot be altered to add default values. 

B. It executes successfully and all the rows that have a null value for the country column will be updated with the value 'USA'. 

C. It executes successfully. The modification to add the default value takes effect only from subsequent insertions to the table. 

D. It produces an error because the data type for the column is not specified. 

Answer:

START 1Z0-061 EXAM