READ Free Dumps For Oracle- 1z0-061
Question ID 21014 | Examine the data in the ename and hiredate columns of the employees table:
You want to generate a list of user IDs as follows:
What is the outcome?
|
Option A | It executes successfully and gives the correct output.
|
Option B | It executes successfully but does not give the correct output.
|
Option C | It generates an error because the REPLACE function is not valid.
|
Option D | It generates an error because the SUBSTR function cannot be nested in the CONCAT function.
|
Correct Answer | A |
Explanation 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
Question ID 21015 | Evaluate the following SQL commands:
The command to create a table fails. Identify the two reasons for the SQL statement failure?
|
Option A | You cannot use SYSDATE in the condition of a check constraint.
|
Option B | You cannot use the BETWEEN clause in the condition of a check constraint.
|
Option C | You cannot use the NEXTVAL sequence value as a default value for a column.
|
Option D | You cannot use ORD_NO and ITEM_NO columns as a composite primary key because ORD_NO is also the foreign key.
|
Correct Answer | A,C |
Explanation 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),