1Z0-061 Premium Bundle

1Z0-061 Premium Bundle

Oracle Database 12c SQL Fundamentals Certification Exam

4.5 
(30675 ratings)
0 QuestionsPractice Tests
0 PDFPrint version
November 23, 2024Last update

Oracle 1Z0-061 Free Practice Questions

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

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

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. You issued the following command: 

SQL> DROP TABLE employees; 

Which three statements are true? 

A. All uncommitted transactions are committed. 

B. All indexes and constraints defined on the table being dropped are also dropped. 

C. Sequences used in the employees table become invalid. 

D. The space used by the employees table is reclaimed immediately. 

E. The employees table can be recovered using the rollback command. 

F. The employees table is moved to the recycle bin. 

Answer: B,C,F 

Reference: http://www.sqlcourse.com/drop.html 

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. Which two statements are true regarding subqueries? 

A. A subquery can retrieve zero or more rows. 

B. Only two subqueries can be placed at one level. 

C. A subquery can be used only in SQL query statements. 

D. A subquery can appear on either side of a comparison operator. 

E. There is no limit on the number of subquery levels in the WHERE clause of a SELECT statement. 

Answer: A,D 

Explanation: 

Using a Subquery to Solve a Problem Suppose you want to write a query to find out who earns a salary greater than Abel’s salary. To solve this problem, you need two queries: one to find how much Abel earns, and a second query to find who earns more than that amount. You can solve this problem by combining the two queries, placing one query inside the other query. The inner query (or subquery) returns a value that is used by the outer query (or main query). Using a subquery is equivalent to performing two sequential queries and using the result of the first query as the search value in the second query. Subquery Syntax A subquery is a SELECT statement that is embedded in the clause of another SELECT statement. You can build powerful statements out of simple ones by using subqueries. They can be very useful when you need to select rows from a table with a condition that depends on the data in the table itself. You can place the subquery in a number of SQL clauses, including the following: WHERE clause HAVING clause FROM clause In the syntax: operator includes a comparison condition such as >, =, or IN Note: Comparison conditions fall into two classes: single-row operators (>, =, >=, <, <>, <=) and multiple-row operators (IN, ANY, ALL, EXISTS). The subquery is often referred to as a nested SELECT, sub-SELECT, or inner SELECT statement. The subquery generally executes first, and its output is used to complete the query condition for the main (or outer) query. Guidelines for Using Subqueries Enclose subqueries in parentheses. Place subqueries on the right side of the comparison condition for readability. (However, the subquery can appear on either side of the comparison operator.) Use single-row operators with single-row subqueries and multiple-row operators with multiple-row subqueries. 

Subqueries can be nested to an unlimited depth in a FROM clause but to “only” 255 levels in a WHERE clause. They can be used in the SELECT list and in the FROM, WHERE, and HAVING clauses of a query. 

Q7. The customers table has the following structure: 

You need to write a query that does the following tasks: 

1. Display the first name and tax amount of the customers. Tax is 5% of their credit limit. 

2. Only those customers whose income level has a value should be considered. 

3. Customers whose tax amount is null should not be considered. 

Which statement accomplishes all the required tasks? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q8. You want to display 5 percent of the employees with the highest salaries in the EMPLOYEES table. 

Which query will generate the required result? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Q9. You need to create a table with the following column specifications: 

1. Employee ID (numeric data type) for each employee 

2. Employee Name (character data type) that stores the employee name 

3. Hire date, which stores the date of joining the organization for each employee 

4. Status (character data type), that contains the value 'active1 if no data is entered 

5. Resume (character large object [CLOB] data type), which contains the resume submitted by the employee 

Which is the correct syntax to create this table? 

A. Option A 

B. Option B 

C. Option C 

D. Option D 

Answer:

Explanation: 

CLOB Character data (up to 4 GB) 

NUMBER [(p, s)] Number having precision p and scale s (Precision is the total number of decimal digits and scale is the number of digits to the right of the decimal point; precision can range from 1 to 38, and scale can range from –84 to 127.) 

Q10. Examine the types and examples of relationships that follow: 

1. One-to-one a) Teacher to students 

2. One-to-many b) Employees to Manager 

3. Many-to-one c) Person to SSN 

4. Many-to-many d) Customers to products 

Which option indicates the correctly matched relationships? 

A. 1-a, 2-b, 3-c, and 4-d 

B. 1-c, 2-d, 3-a, and 4-b 

C. 1-c, 2-a, 3-b, and 4-d 

D. 1-d, 2-b, 3-a, and 4-c 

Answer:

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

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

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

Q14. View the Exhibit for the structure of the student and faculty tables. 

You need to display the faculty name followed by the number of students handled by the faculty at the base location. 

Examine the following two SQL statements: Which statement is true regarding the outcome? 

A. Only statement 1 executes successfully and gives the required result. 

B. Only statement 2 executes successfully and gives the required result. 

C. Both statements 1 and 2 execute successfully and give different results. 

D. Both statements 1 and 2 execute successfully and give the same required result. 

Answer:

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

START 1Z0-061 EXAM