1Z0-061 Premium Bundle

1Z0-061 Premium Bundle

Oracle Database 12c SQL Fundamentals Certification Exam

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

Oracle 1Z0-061 Free Practice Questions

Q1. View 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. Option A 

B. Option B 

C. Option C 

D. Option D 

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

Q2. Examine the structure of the sales table: 

Evaluate the following create table statement: 

Which two statements are true about the creation of the SALES1 table? 

A. The SALES1 table is created with no rows but only a structure. 

B. The SALES1 table would have primary key and unique constraints on the specified columns. 

C. The SALES1 table would not be created because of the invalid where clause. 

D. The SALES1 table would have not null and unique constraints on the specified columns. 

E. The SALES1 table would not be created because column-specified names in the select and create table clauses do not match, 

Answer:

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

Q4. Which statement is true regarding the UNION operator? 

A. By default, the output is not sorted. 

B. Null values are not ignored during duplicate checking. 

C. Names of all columns must be identical across all select statements. 

D. The number of columns selected in all select statements need not be the same. 

Answer:

Explanation: 

The SQL UNION query allows you to combine the result sets of two or more SQL SELECT statements. It removes duplicate rows between the various SELECT statements. Each SQL SELECT statement within the UNION query must have the same number of fields in the result sets with similar data types. 

Q5. View the Exhibit and examine the structure of the SALES table. 

The following query is written to retrieve all those product IDs from the SALES table that have more than 55000 sold and have been ordered more than 10 times. 

Which statement is true regarding this SQL statement? 

A. It executes successfully and generates the required result. 

B. It produces an error because count(*) should be specified in the SELECT clause also. 

C. It produces an error because count{*) should be only in the HAVING clause and not in the WHERE clause. 

D. It executes successfully but produces no result because COUNT (prod_id) should be used instead of COUNT (*). 

Answer:

Explanation: 

Restricting Group Results with the HAVING Clause 

You use the HAVING clause to specify the groups that are to be displayed, thus further 

restricting the groups on the basis of aggregate information. 

In the syntax, group_condition restricts the groups of rows returned to those groups for 

which the specified condition is true. 

The Oracle server performs the following steps when you use the HAVING clause: 

1. Rows are grouped. 

2. The group function is applied to the group. 

3. The groups that match the criteria in the HAVING clause are displayed. 

The HAVING clause can precede the GROUP BY clause, but it is recommended that you 

place the GROUP BY clause first because it is more logical. Groups are formed and group 

functions are calculated before the HAVING clause is applied to the groups in the SELECT 

list. 

Note: The WHERE clause restricts rows, whereas the HAVING clause restricts groups. 

Q6. View the Exhibit and examine the structure of the customers table. 

Using the customers table, you need to generate a report that shows the average credit limit for customers in Washington and NEW YORK. 

Which SQL statement would produce the required result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

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

Q8. View the Exhibit and examine the data in the PROMO_NAME and PROMO_END_DATE columns of the promotions table, and the required output format. 

Which two queries give the correct result? A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: C,D 

Q9. View the Exhibit and examine the structure of the customers table. 

NEW_CUSTOMERS is a new table with the columns CUST_ID, CUST_NAME and CUST_CITY that have the same data types and size as the corresponding columns in the customers table. 

Evaluate the following insert statement: The insert statement fails when executed. 

What could be the reason? 

A. The values clause cannot be used in an INSERT with a subquery. 

B. Column names in the NEW_CUSTOMERS and CUSTOMERS tables do not match. 

C. The where clause cannot be used in a subquery embedded in an INSERT statement. 

D. The total number of columns in the NEW_CUSTOMERS table does not match the total number of columns in the CUSTOMERS table. 

Answer:

Explanation: 

Copying Rows from Another Table 

Write your INSERT statement with a subquery: 

Do not use the VALUES clause. 

Match the number of columns in the INSERT clause to those in the subquery. 

Inserts all the rows returned by the subquery in the table, sales_reps. 

Q10. Examine the create table statements for the stores and sales tables. 

SQL> CREATE TABLE stores(store_id NUMBER(4) CONSTRAINT store_id_pk PRIMARY KEY, store_name VARCHAR2(12), store_address VARCHAR2(20), start_date DATE); 

SQL> CREATE TABLE sales(sales_id NUMBER(4) CONSTRAINT sales_id_pk PRIMARY KEY, item_id NUMBER(4), quantity NUMBER(10), sales_date DATE, store_id NUMBER(4), CONSTRAINT store_id_fk FOREIGN KEY(store_id) REFERENCES stores(store_id)); 

You executed the following statement: 

SQL> DELETE from stores 

WHERE store_id=900; 

The statement fails due to the integrity constraint error: 

ORA-02292: integrity constraint (HR.STORE_ID_FK) violated 

Which three options ensure that the statement will execute successfully? 

A. Disable the primary key in the STORES table. 

B. Use CASCADE keyword with DELETE statement. 

C. DELETE the rows with STORE_ID = 900 from the SALES table and then delete rows from STORES table. 

D. Disable the FOREIGN KEY in SALES table and then delete the rows. 

E. Create the foreign key in the SALES table on SALES_ID column with on DELETE CASCADE option. 

Answer: A,C,D 

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

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

Q13. Which normal form is a table in if it has no multi-valued attributes and no partial dependencies? 

A. First normal form 

B. Second normal form 

C. Third normal form 

D. Fourth normal form 

Answer:

Q14. Examine the structure of the products table: 

You want to display the names of the products that have the highest total value for UNIT_PRICE * QTY_IN_HAND. 

Which SQL statement gives the required output? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

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

START 1Z0-061 EXAM