1Z0-061 Premium Bundle

1Z0-061 Premium Bundle

Oracle Database 12c SQL Fundamentals Certification Exam

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

Oracle 1Z0-061 Free Practice Questions

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

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

Q3. Evaluate the following SQL commands: 

The command to create a table fails. Identify the two reasons for the SQL statement failure? 

A. You cannot use SYSDATE in the condition of a check constraint. 

B. You cannot use the BETWEEN clause in the condition of a check constraint. 

C. You cannot use the NEXTVAL sequence value as a default value for a column. 

D. You cannot use ORD_NO and ITEM_NO columns as a composite primary key because ORD_NO is also the foreign key. 

Answer: A,C 

Explanation: 

CHECK Constraint The CHECK constraint defines a condition that each row must satisfy. The condition can use the same constructs as the query conditions, with the following exceptions: References to the CURRVAL, NEXTVAL, LEVEL, and ROWNUM pseudocolumns Calls to SYSDATE, UID, USER, and USERENV functions Queries that refer to other values in other rows A single column can have multiple CHECK constraints that refer to the column in its definition. There is no limit to the number of CHECK constraints that you can define on a column. CHECK constraints can be defined at the column level or table level. CREATE TABLE employees (... Salary NUMBER(8, 2) CONSTRAINT emp_salary_min CHECK (salary > 0), 

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

Q5. You need to create a table for a banking application. One of the columns in the table has the following requirements: 

1) You want a column in the table to store the duration of the credit period. 

2) The data in the column should be stored in a format such that it can be easily added and subtracted with date data type without using conversion functions. 

3) The maximum period of the credit provision in the application is 30 days. 

4) The interest has to be calculated for the number of days an individual has taken a credit for. 

Which data type would you use for such a column in the table? 

A. DATE 

B. NUMBER 

C. TIMESTAMP 

D. INTERVAL DAY TO SECOND 

E. INTERVAL YEAR TO MONTH 

Answer:

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

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

Q8. You want to create a table employees in which the values of columns EMPLOYEES_ID and LOGIN_ID must be unique and not null. Which two SQL statements would create the required table? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

E. Option E 

F. Option F 

Answer: D,E 

Q9. Which two statements are true regarding constraints? 

A. A table can have only one primary key and one foreign key. 

B. A table can have only one primary key but multiple foreign keys. 

C. Only the primary key can be defined at the column and table levels. 

D. The foreign key and parent table primary key must have the same name. 

E. Both primary key and foreign key constraints can be defined at both column and table levels. 

Answer: B,E 

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. Evaluate the following SQL statement: 

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

A. It executes successfully and displays rows in the descending order of PROMO_CATEGORY. 

B. It produces an error because positional notation cannot be used in the order by clause with set operators. 

C. It executes successfully but ignores the order by clause because it is not located at the end of the compound statement. 

D. It produces an error because the order by clause should appear only at the end of a compound query-that is, with the last select statement. 

Answer:

Q12. View the Exhibit and examine the description of SALES and PROMOTIONS tables. 

You want to delete rows from the sales table, where the PROMO_NAME column in the promotions table has either blowout sale of everyday low prices as values. 

Which three delete statements are valid? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer: B,C,D 

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

Q14. Evaluate the following query: 

What would be the outcome of the above query? 

A. It produces an error because flower braces have been used. 

B. It produces an error because the data types are not matching. 

C. It executes successfully and introduces an 's at the end of each PROMO_NAME in the output. 

D. It executes successfully and displays the literal "{'s start date was \} * for each row in the output. 

Answer: C Explanation: 

So, how are words that contain single quotation marks dealt with? There are essentially two mechanisms available. The most popular of these is to add an additional single quotation mark next to each naturally occurring single quotation mark in the character string 

Oracle offers a neat way to deal with this type of character literal in the form of the alternative quote (q) operator. Notice that the problem is that Oracle chose the single quote characters as the special pair of symbols that enclose or wrap any other character literal. 

These character-enclosing symbols could have been anything other than single quotation marks. 

Bearing this in mind, consider the alternative quote (q) operator. The q operator enables you to choose from a set of possible pairs of wrapping symbols for character literals as alternatives to the single quote symbols. The options are any single-byte or multibyte character or the four brackets: (round brackets), {curly braces}, [squarebrackets], or <angle brackets>. Using the q operator, the character delimiter can effectively be changed from a single quotation mark to any other character 

The syntax of the alternative quote operator is as follows: 

q'delimiter'character literal which may include the single quotes delimiter' where delimiter can be any character or bracket. 

Alternative Quote (q) Operator 

Specify your own quotation mark delimiter. 

Select any delimiter. 

Increase readability and usability. 

SELECT department_name || q'[ Department's Manager Id: ]' 

|| manager_id 

AS "Department and Manager" 

FROM departments; 

Alternative Quote (q) Operator 

Many SQL statements use character literals in expressions or conditions. If the literal itself contains a single quotation mark, you can use the quote (q) operator and select your own quotation mark delimiter. 

You can choose any convenient delimiter, single-byte or multi byte, or any of the following character pairs: [ ], { }, ( ), or < >. 

In the example shown, the string contains a single quotation mark, which is normally interpreted as a delimiter of a character string. By using the q operator, however, brackets 

[] are used as the quotation mark delimiters. The string between the brackets delimiters is interpreted as a literal character string. 

Q15. You want to display the date for the first Monday of the next month and issue the following command: 

What is the outcome? 

A. It executes successfully and returns the correct result. 

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

C. It generates an error because TO_CHAR should be replaced with TO_DATE. 

D. It generates an error because rrrr should be replaced by rr in the format string. 

E. It generates an error because fm and double quotation marks should not be used in the format string. 

Answer:

START 1Z0-061 EXAM