View the Exhibit and examine the structure of the CUSTOMERS table.
Answer : A
Examine the data in the ename and hiredate columns of the employees table:
Answer : A
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
Examine the data in the PROMO_BEGIN_DATE column of the promotions table:
Answer : A
The customers table has the following structure:
Answer : B
Evaluate the following SQL statement:
Answer : D
YOU need to display the date ll-oct-2007 in words as Eleventh of October, Two Thousand
Seven'.
Which SQL statement would give the required result?
Answer : A
Examine the structure of the products table:
Answer : A
You issue the following command to alter the country column in the departments table:
Answer : B
Examine the structure and data of the CUST_TRANS table:
Answer : A,C,D
Which two statements are true regarding the count function?
Answer : B,D
Explanation:
Using the COUNT Function -
The COUNT function has three formats:
COUNT(*)
COUNT(expr)
COUNT(DISTINCT expr)
COUNT(*) returns the number of rows in a table that satisfy the criteria of the SELECT statement, including duplicate rows and rows containing null values in any of the columns.
If a WHERE clause is included in the SELECT statement, COUNT(*) returns the number of rows that satisfy the condition in the WHERE clause.
In contrast,
COUNT(expr) returns the number of non-null values that are in the column identified by expr.
COUNT(DISTINCT expr) returns the number of unique, non-null values that are in the column identified by expr.
Which statement is true regarding the default behavior of the order by clause?
Answer : A
Explanation:
Character Strings and Dates -
Character strings and date values are enclosed with single quotation marks.
Character values are case-sensitive and date values are format-sensitive.
The default date display format is DD-MON-RR.
View the Exhibit and examine the structure of the customers table.
Answer : C
Which two statements are true regarding subqueries?
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 Abels 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.
View the Exhibits and examine products and sales tables.
Answer : A
Examine the structure of the transactions table:
Answer : B