• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/1974

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

1974 Cards in this Set

  • Front
  • Back
TO_DSINTERVAL()
TO_DSINTERVAL()

TO_DSINTERVAL converts a character string of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type to an INTERVAL DAY TO SECOND type.

TO_DSINTERVAL accepts argument in one of the two formats:
■ SQL interval format compatible with the SQL standard (ISO/IEC 9075:2003)
■ ISO duration format compatible with the ISO 8601:2004 standard
It enables users to reuse the same query block in a SELECT statement if it occurs more than once in a complex query - Correct or Incorrect regarding the Benefits of using the WITH clause ?
Correct
View the Exhibit and examine the data in the EMPLOYEES tables.

Evaluate the following SQL statement:

SELECT employee_id, department_id
FROM employees
WHERE department_id= 50 ORDER BY department_id
UNION
SELECT employee_id, department_id
FROM employees
WHERE department_id= 90
UNION
SELECT employee_id, department_id
FROM employees
WHERE department_id= 10;

What would be the outcome of the above SQL statement?

A. The statement would execute successfully and display all the rows in the ascending order of
DEPARTMENT_ID.

B. The statement would execute successfully but it will ignore the ORDER BY clause and display
the rows in random order.

C. The statement would not execute because the positional notation instead of the column name
should be used with the ORDER BY clause.

D. The statement would not execute because the ORDER BY clause should appear only at the
end of the SQL statement, that is, in the last SELECT statement.
D
Which character classes defines only uppercase letters?
[:upper:]
If the list of ORDER BY expressions uses the “by position” form, then all expressions in the ORDER BY must use the “by position” form - Correct or Incorrect of ORDER BY clause ?
Incorrect
Evaluate this SELECT statement that includes a subquery:

SELECT last_name, first_name, phone_num
FROM prospect
WHERE postal_code IN (SELECT postal_code
FROM sales WHERE salesperson_id = 25);

Which two statements are true about the given subquery? (Choose two.)

The query on the prospect table executes before the query on the sales table.

THe results of the query on the sales table are returned to the query on the prospect table.

The results of the query on the prospect table are returned to the query on the sales table.

The query on the sales table executes once for the execution of the query on the prospect table.

The query on the sales and the query on the prospect table must both return a value or an error occurs
The results of the query on the sales table are returned to the query on the prospect table.

The query on the sales table executes once for the execution of the query on the prospect table.
Multitable Insert use a subquery to insert values - Correct or Incorrect ?
Correct
Which statement would you use to create a nonunique index on a table?
the CREATE INDEX statement
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. You have used the TO_DATE conversion function to subtract two date values.

The following query is used to accomplish the task:

SELECT TO_DATE('02-AUG-2007') - TO_DATE('25-JUL-2007') FROM DUAL;

Which of the following statements about the above mentioned SQL query is true?

A: Oracle will display an error message, as two date values cannot be subtracted.

B: Oracle will display 8 as the output.

C: Oracle will display 02-AUG-2007 as the output.

D: Oracle will display 25-JUL-2007 as the output
B: Oracle will display 8 as the output
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its database. The database contains a table named Employees. You issue the following set
of queries:

Q1: SELECT End_date, COUNT(*)
FROM EMPLOYEES;

Q2: SELECT End_date, Start_date, COUNT(*)
FROM EMPLOYEES GROUP BY End_date;

Q3: SELECT TO_CHAR (End_date, 'YYYY') "Year", COUNT(*) "Number of
employees" FROM EMPLOYEES
GROUP BY TO_CHAR(End_date, 'YYYY')
ORDER BY COUNT(*) DESC;

Q4: SELECT Start_date, End_date COUNT(*)
FROM EMPLOYEES GROUP BY Start_date
WHERE AVG(LENGTH(Emp_last_name)) > 8;

Which of the following queries will not generate an ORA error?

A: Q2
B: Q4
C: Q3
D: Q1
C: Q3
Pacific Standard Time is abbreviated PST. PST is an example of which format model element?
TZD
The CUBE operation can only be performed with:
GROUP BY
It returns 1 for those rows that have NULL values for the regular grouped rows - Correct or Incorrect about GROUPING FUNCTION ?
Incorrect
In which clauses of a SELECT statement can a scalar subquery NOT be used?
GROUP BY
Review this SQL statement: SELECT TRUNC(ROUND(ABS(-1.7),2)) FROM DUAL; What will be the result of the SQL statement?
1
Indexes should be created on columns that are frequently referenced as part of an expression - Correct or Incorrect about INDEXES ?
Incorrect
Which keywords can be used with the CREATE SEQUENCE statement?
CYCLE / MAXVALUE / INCREMENT
Evaluating MOD(20,3) returns what value?
2
Which database roles provides the privileges required to perform full and incremental database exports?
EXP_FULL_DATABASE
You use Synonyms to shorten lengthy table names - Correct or Incorrect about Synonyms ?
Correct
GREATEST()
GREATEST returns the greatest of the list of one or more expressions. Oracle Database uses the first expr to determine the return type. If the first expr is numeric, then Oracle determines the argument with the highest numeric precedence, implicitly converts the remaining arguments to that data type before the comparison, and returns
that data type. If the first expr is not numeric, then each expr after the first is implicitly converted to the data type of the first expr before the comparison.

Character comparison is based on the numerical codes of the characters in the database character set and is performed on whole strings treated as one sequence of bytes, rather than character by character. If the value returned by this function is
character data, then its data type is VARCHAR2 if the first expr is a character data type and NVARCHAR2 if the first expr is a national character data type.
WITH clause cannot be specified in any top-level SELECT statement and in most types of subqueries - Correct or Incorrect ?
Incorrect
Which database objects stores table column data and row reference information?
Indexes
Single Row Functions can modify the data type of the argument that is referenced. - True or False ?
1
Which database objects can be used to generate the Primary key value?
Sequence
Which is not supported by Oracle as an internal data type?
STRING
The DESCRIBE command would still display the sales_date column - Correct or Incorrect about ALTER TABLE … SET UNUSED ?
Incorrect
The child and parent tables must be on different database - Correct or Incorrect about FOREIGN KEY constraint ?
Incorrect
The USING clause is optional - Correct or Incorrect about the USING clause of MERGE statement ?
Incorrect
The actual data never gets stored inside the database - Correct or Incorrect about EXTERNAL tables ?
Correct
Consider the following query executed on a products table:

SELECT * FROM products GROUP BY CUBE(product_quantity, product_cost);

Which of the following statements is TRUE about the given query?

There is only one group.

There are two groups of rows.

There are three groups of rows.

There are four groups of rows.
There are four groups of rows.
Consider the following statement executed for an employee records database:

CREATE TABLE employee_info
(
emp_id NUMBER(5),
dept_id NUMBER(5),
designation VARCHAR(30),
salary NUMBER(5),
CONSTRAINT emp_pk PRIMARY KEY (emp_id))
ORGANIZATION INDEX
INCLUDING dept_id
OVERFLOW TABLESPACE employee_tablespace;

Which of the following statements are FALSE about the preceding statement? (Choose all that apply.)

The employee_info table is an index-organized table.

The employee_info table does not have an index.

The index block contains only the primary key emp_id.

The rows are sorted based on the emp_id and the dept_id columns.
The employee_info table does not have an index.

The index block contains only the primary key emp_id.

The rows are sorted based on the emp_id and the dept_id columns
LPAD()
LPAD returns expr1, left-padded to length n characters with the sequence of characters in expr2. This function is useful for formatting the output of a query.

Both expr1 and expr2 can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The string returned is of VARCHAR2 data type if expr1 is a character data type, NVARCHAR2 if expr1 is a national character data type, and a LOB if expr1 is a LOB data type. The string returned is in the same character set as
expr1. The argument n must be a NUMBER integer or a value that can be implicitly
converted to a NUMBER integer.

If you do not specify expr2, then the default is a single blank. If expr1 is longer than n, then this function returns the portion of expr1 that fits in n.

The argument n is the total length of the return value as it is displayed on your terminal screen. In most character sets, this is also the number of characters in the return value. However, in some multibyte character sets, the display length of a
character string can differ from the number of characters in the string.

The following example left-pads a string with the asterisk (*) and period (.) characters:

SELECT LPAD('Page 1',15,'*.') "LPAD example"
FROM DUAL;

LPAD example
---------------
*.*.*.*.*Page 1
Your business team has decided not to use the "SAL" column of the table T1 anymore
and asks you to drop it immediately. However, the table T1 is heavily accessed during business hours by users.

Which of the following options shows the correct method of dropping the "SAL" column from table T1?

A: Run the following statement during business hours:

ALTER TABLE T1 SET UNUSED (SAL);

B: Run the following statement after business hours:

ALTER TABLE T1 DROP COLUMN SAL;

C: Run the following statement during business hours:

ALTER TABLE T1 DROP COLUMN SAL;

D: Run the following statement during business hours:

ALTER TABLE T1 SET UNUSED (SAL);

and run the below statement after business hours:

ALTER TABLE T1 DROP UNUSED COLUMNS;
D: Run the following statement during business hours:
ALTER TABLE T1 SET UNUSED (SAL);

and run the below statement after business hours:
ALTER TABLE T1 DROP UNUSED COLUMNS;
You need to define a regular expression pattern that specifies a string of one or more alphabetic characters. Which patterns will do this?
'[[:alpha:]]+'
You work as a Database Administrator for Gadgets Inc. Two days ago, there was an
error in the accounting department. The error amounted to a few of the generated bills.
Now, you receive a call from a customer of Customer Id 6721 complaining about a bill
that was delivered to him. The complainant said that the total amount in the bill was overestimated by $400.

What will you do to confirm that the customer was actually affected by the error?

A: You will use a Flashback query as follows:

SELECT order_id, customer_id, order_total from orders as of timestamp (sysdate - 2)
where customer_id = 6721;

B: You will use a Flashback query as follows:

SELECT order_id, customer_id, order_total from orders as of timestamp (systimestamp - interval '2' minute) where customer_id = 6721;

C: You will use a Flashback query as follows:

SELECT order_id, customer_id, order_total from orders as of timestamp (to_timestamp ('2-sep-06 18:16:45. 845993', 'DD-Mon-RR HH24:MI:SS.FF'))
where customer_id = 6721;

D: You will use a Flashback query requiring undo data, which is now not present in the undo tablespace:

SELECT order_id, customer_id, order_total from orders as of timestamp (systimestamp - interval '2' month) where customer_id = 6721;
A: You will use a Flashback query as follows:
SELECT order_id, customer_id, order_total from orders
as of timestamp (sysdate - 2) where customer_id = 6721;
How do group functions handle NULL values?
Group functions ignore NULL values.
Susan maintains the database for a library. She needs to find the number of times the Word 'Database' appears in each book's title.

Which of the following functions should you use in this scenario?

REGEXP_INSTR
REGEXP_SUBSTR
REGEXP_COUNT
REGEXP_LIKE
REGEXP_COUNT
Which clauses is used to specify the target for the MERGE statement?
INTO
You work as a Database Administrator for Dolliver Inc. The company uses Oracle 11g as its database. The database contains a table named Employee. You want to alias a column named Emp_dependents to Employee Family Size and also retrieve the column.
The case of the alias should not change.

Which of the following SQL statements will you
use to accomplish the task?

Each correct answer represents a complete solution. Choose two.

A: SELECT EMP_dependents AS "Employee Family Size" FROM Employee;

B: SELECT EMP_dependents AS Employee Family Size FROM Employee;

C: SELECT EMP_dependents "Employee Family Size" FROM Employee;

D: SELECT EMP_dependents AS 'Employee Family Size' FROM Employee;
A: SELECT EMP_dependents AS "Employee Family Size" FROM Employee;

C: SELECT EMP_dependents "Employee Family Size" FROM Employee;
Which comparison operator is used when matching character patterns?
the LIKE operator
There are two tables A and B, which are to be joined to retrieve data from both of them. However, there is one condition that all the rows retrieved from A and B should be displayed in the result set even if they do not meet the join condition.

What kind of join will you perform to get the desired result set?

A: Left outer join
B: Cartesian product
C: Right outer join
D: Full outer join
D: Full outer join
INTERVAL '540' DAY(3) - INTERVAL '480' HOUR - INTERVAL '15 12:30' DAY TO MINUTE + INTERVAL '12:30' HOUR TO MINUTE; Which represent the values of the given expression?
INTERVAL '505' DAY(3) / INTERVAL '12120' HOUR(5)
It returns 1 for those rows that have subtotals computed by ROLLUP or CUBE - Correct or Incorrect about GROUPING FUNCTION ?
Correct
It finds all the DEFAULT values in the superaggregates for the groups specified in the GROUP BY clause - Correct or Incorrect regarding CUBE operator ?
Incorrect
A self join can never return a cartesian product - Correct or Incorrect about Self-Joins ?
Incorrect
What value is returned after executing the following statement? SELECT INSTR('How_long_is_a_piece_of_string?','_',5,3) FROM DUAL;
14
It can be used only with the SELECT clause - Correct or Incorrect regarding the usage of WITH clause in complex correlated queries ?
Correct
Which character function substitutes one string for another?
REPLACE. The syntax of the REPLACE function is REPLACE(column|expression, search_string [,'replacement_string'])
GRANT UPDATE ON inventory TO joe WITH GRANT OPTION; Which task was accomplished?
Only an object privilege was granted to user Joe.
Can subqueries contain group functions?
Yes
Indexes can be used to precompute complex values without using a trigger - Correct or Incorrect about Indexes ?
Correct
SYSDATE()
SYSDATE()

SYSDATE returns the current date and time set for the operating system on which the
database server resides. The data type of the returned value is DATE, and the format
returned depends on the value of the NLS_DATE_FORMAT initialization parameter. The
function requires no arguments. In distributed SQL statements, this function returns the date and time set for the operating system of your local database. You cannot use this function in the condition of a CHECK constraint.
The number generated by a sequence can be used only for one table - Correct or Incorrect about Sequences created in a single instance database ?
Incorrect
Single Row Functions cannot be nested - True or False ?
FALSE
Which commands is used to revoke system level privileges that were previously granted with the grant command?
Revoke
What are the general kinds of methods that can be declared in a type definition?
Static Methods, Member Methods, Constructor Methods
All of the following are DBA views that are used to describe all relational tables in the database except for which one? - USER_TABLES , DBA_TABLES, ALL_TABLES, DBA_TAB_COLUMNS
DBA_TAB_COLUMNS
What is the term for a subquery in which two or more values from the main query are matched to two or more values of the subquery?
a multicolumn subquery
It is not possible to define a foreign key constraint in a CREATE TABLE statement that contains an AS subquery clause - Correct or Incorrect about FOREIGN KEY constraint ?
Correct
Which can be used with the flashback query to obtain historic data that existed during the specified time frame?
Undo retention period
In order to avail the maximum benefit from the flash recovery area in Oracle 10g, you want to maximize its space. parameters. Which parameter / parameters will you configure to accomplish the task?
DB_RECOVERY_FILE_DEST_SIZE
It removes all the rows in the table and allows ROLLBACK - Correct or Incorrect about DELETE FROM statements ?
Correct
Which of the following set operators returns all rows selected by either query, including all duplicates?
UNION ALL
A Cartesian product generates a large number of rows, and the result of a Cartesian product is rarely used. This can be considered a disadvantage of a Cartesian product.

Which of the following are the reasons for using a Cartesian product?

Each correct answer represents a complete solution. Choose two.

A: It is used to simulate a reasonable amount of data.

B: It is used to retrieve the desired rows from a table.

C: It is used to retrieve all rows from a table.

D: It is used to join two tables
A: It is used to simulate a reasonable amount of data

D: It is used to join two tables
SESSIONTIMEZONE()
SESSIONTIMEZONE()

SESSIONTIMEZONE returns the time zone of the current session. The return type is a time zone offset (a character type in the format '[+|]TZH:TZM') or a time zone region name, depending on how the user specified the session time zone value in the most recent ALTER SESSION statement.

The following example returns the time zone of the current session:

SELECT SESSIONTIMEZONE FROM DUAL;
SESSION
-------
-08:00
Evaluate the following SQL statement:

DROP TABLE Order;
CREATE TABLE Order
(OrdNo NUMBER(3) PRIMARY KEY,
OrdName VARCHAR2(10)
OrderType VARCHAR2(10));
DROP TABLE Order;

FLASHBACK TABLE Order TO BEFORE DROP;

Which of the following statements is true regarding the above Flashback operation?

A: It will recover only the first Order table.

B: It will recover both the tables but the names would be changed to the ones assigned
in the RECYCLE BIN.

C: It will recover only the second Order table.

D: It does not recover any of the tables because Flashback is not possible in this case
C: It will recover only the second Order table
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its
database. The database contains a table named Job_recruitment. The table contains columns such as Joining_date, Leaving_date, Tot_salary, and Tot_incentive. The Joining_date and Leaving_date columns are of DATE data type. You perform the following arithmetic operation on these columns:

Joining_date - Leaving_date

What will the above arithmetic operation return?

A: It will return the result in VARCHAR2 data type.
B: It will return the result in NUMBER data type.
C: It will return the result in DATE data type.
D: It will return an ORA error.
B: It will return the result in NUMBER data type.
The ORDER BY clause specifies one or more terms by which the retrieved rows are sorted.These terms can only be column names - Correct or Incorrect of ORDER BY clause ?
Incorrect
When a correlated query is processed the following steps are taken.

1. The inner query returns qualified rows only.
2. The final result set is displayed.
3. A row is fetched by the outer parent query.
4. The row is processed by the inner sub-query along with other column values.
5. The row values are passed on to the inner query.
6. The outer query processes the next row from the table in similar manner till no rows are left to be processed

Which of the following is the correct order in which these steps are followed?

A: 6, 3, 5, 4, 1, 2
B: 3, 5, 4, 1, 6, 2
C: 5, 3, 1, 6, 4, 2
D: 3, 5, 1, 4, 6, 2
B: 3, 5, 4, 1, 6, 2
In which of the following is the SELECT query of a subquery always enclosed?
Parentheses
View the Exhibit and examine the data in the CUST_DET table.

You executed the following multitable INSERT statement:

INSERT FIRST
WHEN credit_limit >= 5000 THEN
INTO cust_1 VALUES(cust_id, credit_limit, grade, gender) WHEN grade = THE INTO cust_2 VALUES(cust_id, credit_limit, grade, gender)
WHEN gender = THE INTO cust_3 VALUES(cust_id, credit_limit, grade, gender)
INTO cust_4 VALUES(cust_id, credit_limit, grade, gender)
ELSE
INTO cust_5 VALUES(cust_id, credit_limit, grade, gender)
SELECT * FROM cust_det;

The row will be inserted in________.

A. CUST_1 table only because CREDIT_LIMIT condition is satisfied

B. CUST_1 and CUST_2 tables because CREDIT_LIMIT and GRADE conditions are satisfied

C. CUST_1 ,CUST_2 and CUST_5 tables because CREDIT_LIMIT and GRADE conditions are satisfied but GENDER condition is not satisfied

D. CUST 1, CUST 2 and CUST 4 tables because CREDIT LIMIT and GRADE conditions are
satisfied for CUST 1 and CUST 2, and CUST 4 has no condition on it
A
Which comparison operator allows you to compare a value to a range of values?
the BETWEEN... AND operator
View the Exhibit and examine the data in the DEPARTMENTS tables.

Evaluate the following SQL statement:

SELECT department_id "DEPT_ID", department_name , 'b' FROM departments
WHERE department_id=90
UNION
SELECT department_id, department_name DEPT_NAME, 'a' FROM departments
WHERE department_id=10

Which two ORDER BY clauses can be used to sort the output of the above statement? (Choose
two.)

A. ORDER BY 3;
B. ORDER BY 'b';
C. ORDER BY DEPT_ID;
D. ORDER BY DEPT NAME
A,C
List the values that would match the following regular expression: ['abc']{3,5}
abcabcabc or abcabcabcabc or abcabcabcabcabc
The ROLLUP operator delivers aggregates and super aggregates for expressions within a GROUP BY statement - Correct or Incorrect about ROLLUP operator ?
Correct
It returns 0 for those rows that have subtotals computed by ROLLUP or CUBE - Correct or Incorrect about GROUPING FUNCTION ?
Incorrect
Given in the table below is the list of meta character syntaxes and their description in
random order. Identify the option that correctly matches the meta character syntaxes
with their descriptions.

S.No Meta Character
Syntax
1 ^a
2 [^ ]
3 |
4 \

Description
a Is used to ensure that a character is not in the list.
b Matches the pattern at the beginning of the string.
c Treats the subsequent meta character as a literal.
d Matches one of the character, such as the OR operator.

A: 1-b, 2-c, 3-b, 4-d
B: 1-b, 2-a, 3-d, 4-c
C: 1-a, 2-d, 3-a, 4-b
D: 1-d, 2-c, 3-a, 4-b
B: 1-b, 2-a, 3-d, 4-c
Table aliases should be used to self join the table - Correct or Incorrect about Self-Joins ?
Correct
A WITH clause can occur inside another WITH clause - Correct or Incorrect about the WITH clause ?
Incorrect
If you want to calculate the number of days between the two given dates, which date function should you use?
MONTHS_BETWEEN
Which of the following functions is used when a non-NULL value needs to be returned in place of a NULL value?
NVL2
Which operators returns all distinct rows selected by the first query but not the second?
MINUS
Which attributes of the CREATE SEQUENCE statement is used to specify the number of values of the sequence the database has preallocated and kept in memory for faster access?
CACHE
TO_CHAR may convert numbers to character items - Correct or Incorrect ?
Correct
NVL2()
NVL2()

NVL2 lets you determine the value returned by a query based on whether a specified expression is null or not null. If expr1 is not null, then NVL2 returns expr2. If expr1 is null, then NVL2 returns expr3.

The argument expr1 can have any data type. The arguments expr2 and expr3 can have any data types except LONG.

If the data types of expr2 and expr3 are different, then Oracle Database implicitly converts one to the other. If they cannot be converted implicitly, then the database returns an error. If expr2 is character or numeric data, then the implicit conversion is implemented as follows:

■ If expr2 is character data, then Oracle Database converts expr3 to the data type of expr2 before returning a value unless expr3 is a null constant. In that case, a data type conversion is not necessary, and the database returns VARCHAR2 in the character set of expr2.
■ If expr2 is numeric data, then Oracle Database determines which argument has the highest numeric precedence, implicitly converts the other argument to that data type, and returns that data type.
EMP is a private synonym for the OE.EMPLOYEES table. DROP SYNONYM EMP; Which statement is true regarding the above SQL statement?
Only the synonym would be dropped
The DBA_TAB_PRIVS data dictionary view allows a user account to see object privileges it has granted to other user accounts - Correct or Incorrect ?
Correct
For a user to create a table successfully in a database, which of the following holds true?
Grant the user CREATE TABLE Privilege, Allocate quota on a tablespace to that user.
The OR REPLACE option is used to change the definition of an existing view without dropping and recreating it - Correct or Incorrect about a VIEW ?
Correct
Which data types are variable length?
BLOB, LONG, NUMBER, RAW, VARCHAR2
In which of the following SQL clauses is the sub-query usually placed while writing a multiple-column sub-query?
FROM, WHERE
Tasks Performed By - LPAD --
Pads the character value right-justified to a total width of n character positions.
Rows are either inserted or updated in the target table during a single pass of the source table - Correct or Incorrect about MERGE statement ?
Correct
It returns versions of rows only within a transaction - Correct or Incorrect about FLASHBACK Version Query?
Incorrect
What does ACID stand for?
Atomicity, Consistency, Isolation, and Durability
How does the USER_TABLES dictionary view differ from the ALL_TABLES data dictionary view?
USER_TABLES will display only the tables owned by the user
CONCAT()
CONCAT returns char1 concatenated with char2. Both char1 and char2 can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The string returned is in the same character set as char1. Its data type depends on the data types of the arguments.

In concatenations of two different data types, Oracle Database returns the data type that results in a lossless conversion. Therefore, if one of the arguments is a LOB, then the returned value is a LOB. If one of the arguments is a national data type, then the returned value is a national data type. For example:

■ CONCAT(CLOB, NCLOB) returns NCLOB
■ CONCAT(NCLOB, NCHAR) returns NCLOB
■ CONCAT(NCLOB, CHAR) returns NCLOB
■ CONCAT(NCHAR, CLOB) returns NCLOB

This function is equivalent to the concatenation operator (||).

This example uses nesting to concatenate three character strings:

SELECT CONCAT(CONCAT(last_name, '''s job category is '), job_id) "Job" FROM employees
WHERE employee_id = 152;

Job
------------------------------------------------------
Hall's job category is SA_REP
View the Exhibit and examine the description of the EMPLOYEES table.

You want to display the EMPLOYEE_ID, FIRST_NAME, and DEPARTMENT_ID for all the
employees who work in the same department and have the same manager as that of the
employee having EMPLOYEE_ID 104.

To accomplish the task, you execute the following SQL statement:

SELECT employee_id, first_name, department_id
FROM employees
WHERE (manager_id, department_id) =(SELECT department_id, manager_id FROM employees
WHERE employee_id = 104)
AND employee_id <> 104;

When you execute the statement it does not produce the desired output. What is the reason for
this?

A. The WHERE clause condition in the main query is using the = comparison operator, instead of EXISTS.

B. The WHERE clause condition in the main query is using the = comparison operator, instead of the IN operator.

C. The WHERE clause condition in the main query is using the = comparison operator, instead of the = ANY operator.

D. The columns in the WHERE clause condition of the main query and the columns selected in the
subquery should be in the same order.
D
Given below are two tables: one contains the date time data type and the other one contains a list of values stored in them in a random order:

Data Type
-------------
1 INTERVAL YEAR TO MONTH
2 TIMESTAMP WITH LOCAL TIME ZONE
3 TIMESTAMP WITH TIME ZONE
4 INTERVAL DAY TO SECOND

Example
-----------
a '2008-06-15 8:00:00 -8:00'
b '+06 03:30 18.000000'
c '18-JAN-03 12.00.00.000000 AM'
d '+04-00'

Identify the option that correctly matches the data types with the values given in the example.

A: 1-b, 2-c, 3-d, 4-c
B: 1-d, 2-c, 3-a, 4-b
C: 1-b, 2-a, 3-c, 4-d
D: 1-d, 2-a, 3-b, 4-c
B: 1-d, 2-c, 3-a, 4-b
You work as a Database Administrator for Gadgets Inc. The company uses Oracle as its
database. One of the policies of the company is to provide incentives to its deserving employees. Now, you want to retrieve the salaries of those employees who are eligible for incentives. You also want to sort the data by the employee's first name in ascending order.

Which of the following clauses will you use to sort the data?

A: HAVING
B: DISTINCT
C: GROUP BY
D: ORDER BY
D: ORDER BY
Which features is used to retrieve metadata and historical data for a specific time interval?
Oracle Flashback Version Query
ROWIDTOCHAR()
ROWIDTOCHAR()

ROWIDTOCHAR converts a rowid value to VARCHAR2 data type. The result of this
conversion is always 18 characters long.
Can you sort by a column that is NOT included in the SELECT list?
Yes, you can include a column in the ORDER BY clause even if it is not included in the SELECT list.
You are the DBA in a retail store selling different products. You execute the following query to display records from the orders_info table:

SELECT * FROM orders_info
GROUP BY GROUPING SETS product_id,(order_id, order_date), ROLLUP(order_id, cost,
delivery_status);

How many groups are created in total as a result of the given query?

3
4
5
6
6
The HAVING clause is used to exclude one or more aggregated results after grouping data. - Correct or Incorrect ?
Correct
Group Functions can be passed as an argument to another group function - Correct or Incorrect ?
Correct
GROUP BY GROUPING SETS is an alternative to which of the following?
GROUP BY CUBE
View the Exhibit and examine the descriptions of the EMPLOYEES and DEPARTMENTS tables.

The following SQL statement was executed:

SELECT e.department_id, e.job_id, d.location_id, sum(e.salary) total, GROUPING(e. department_id) GRP_DEPT, GROUPING(e.job_id) GRPJOB,
GROUPING(d. location_id) GRP_LOC
FROM employees e JOIN departments d
ON e.department_id = d.department_id
GROUP BY ROLLUP (e.department_id, e.job_id, d.location_id);

View the Exhibit2 and examine the output of the command.

Which two statements are true regarding the output? (Choose two.)

A. The value 1 in GRP_LOC means that the LOCATION_ID column is taken into account to
generate the subtotal.

B. The value 1 in GRPJOB and GRP_LOC means that JOB_ID and LOCATION_ID columns are not taken into account to generate the subtotal.

C. The value 1 in GRPJOB and GRP_LOC means that the NULL value in JOBJD and
LOCATIONJD columns are taken into account to generate the subtotal.

D. The value 0 in GRP_DEPT, GRPJOB, and GRP_LOC means that DEPARTMENT_ID, JOB_ID,and LOCATION_ID columns are taken into account to generate the subtotal
B,D
You are the database administrator in a corporate organization. Records of all employees are stored in the employees table, while records of all retired employees are stored in the retired_employees table. You need to remove the rows from the employees table for all the employees who have retired before 1990.

Which of the following statements should you use to achieve the desired results?

DELETE FROM retired_employees
WHERE retire_year<1990;

DELETE FROM retired_employees
WHERE emp_id IN (SELECT emp_id FROM employees);

DELETE FROM employees
WHERE emp_id IN (SELECT emp_id FROM retired_employees WHERE retire_year<1990);

DELETE FROM employees
WHERE emp_id NOT IN (SELECT emp_id FROM retired_employees WHERE retire_year<1990);
DELETE FROM employees
WHERE emp_id IN (SELECT emp_id FROM retired_employees WHERE retire_year<1990);
A self-join is:
A SELECT statement that specifies one table twice in the FROM clause / A SELECT statement that joins a table to itself by connecting a column in the table to a different column in the same table
A NOT NULL constraint is stored in the data dictionary as a UNIQUE constraint - Correct or Incorrect about NOT NULL constraints ?
Incorrect
What is the maximum number of decimal positions you can specify for a timestamp datatype?
9
It is used to identify if the NULL value in an expression is a stored NULL value or created by ROLLUP of CUBE - Correct or Incorrect about GROUPING function ?
Correct
Which expression will add five days to the current date?
SYSDATE + 5
What is another name for an outer query?
the main query
TO_DATE may convert character items to date items - Correct or Incorrect ?
Correct
View the exhibit and examine the data in the Sales_Master and Monthly_Sales tables:

Sales_Master
Sale_ID Sale_Total
1 1000
2 3000
3 5000
4
Monthly_Sales
Sale_ID Sale_Total
2 35000
3

Based on the above two tables, evaluate the following MERGE statement and identify
the outcome of the following SQL statement:

MERGE INTO Sales_Master s
USING Monthly_Sales m
ON (s.Sale_ID=m.Sale_ID)
WHEN MATCHED THEN
UPDATE SET s.Sale_Total=m.Sale_Total
DELETE WHERE(m.Sale_Total IS NULL)
WHEN NOT MATCHED THEN
INSERT VALUES (m.Sale_ID, m.Sale_Total);

A: The Sales_Master table would contain the Sale_IDs 1, 2, 3, and 4.
B: The Sales_Master table would contain the Sale_IDs 1, 2, and 3.
C: The Sales_Master table would contain the Sale_IDs 1, 2, and 4.
D: The Sales_Master table would contain the Sale_IDs 1 and 2.
C: The Sales_Master table would contain the Sale_IDs 1, 2, and 4.
Which statement will user Barbara use to create a private synonym when referencing the EMPLOYEE table existing in user Chan's schema?
CREATE SYNONYM emp FOR chan.employee;
What can be granted to a role?
System privileges / Object privileges / Roles
Which should you use along with the view to change the definition of an existing view without dropping and recreating?
OR REPLACE
A column with the UNIQUE constraint may contain NULL - True or False ?
1
Which operations can a user perform once he is granted the system level privilege?
Perform DBA activities / Alter session related parameters / Connect to the database
Can you use CURRVAL or NEXTVAL As the DEFAULT value of a column in the CREATE TABLE or ALTER TABLE command ?
No
What is the significance of DUAL ?
DUAL is a dummy table used to view results returned by functions.
What is the relationship between schemas and tablespaces?
No relationship
An external table does not describe how data is stored in the external source - Correct or Incorrect about EXTERNAL tables ?
Correct
TRUNCATE is better if all the rows are to be deleted from a table - Correct or Incorrect ?
Correct
When you’re looking for a particular bit of data and you’re not sure where in the data dictionary it might be, a good starting point is:
SELECT * FROM DICTIONARY;
Which statements is used to remove entire row of data from a specified table or view?
DELETE statement
You are the database administrator of a large department store. You need to store and maintain data about the different products available.

Assume that productid, orderid, and customerid are all datatype varchar2(8).

You execute the following query:

SQL> SELECT productid, to_char(NULL), to_char(NULL) FROM products
UNION ALL
(SELECT productid, orderid, to_char(NULL) FROM orders
UNION
SELECT productid, orderid, customerid FROM customers) ORDER BY 3;

Which of the following statements are TRUE about the output of this query? (Choose all that apply).

The output contains rows sorted by the customerid column in ascending order.

The output contains rows sorted by the customerid column in descending order.

An error occurs because the ORDER BY clause uses a column that does not exist in the first SELECT statement.

An ORDER BY clause appears at the end of the last query when using SET operators.
The output contains rows sorted by the customerid column in ascending order.

An ORDER BY clause appears at the end of the last query when using SET operators.
Evaluate this CREATE TABLE statement (line numbers are for reference only):

1. CREATE TABLE order*1 (
2. order# NUMBER(9),
3. cust_id NUMBER(9),
4. date_1 DATE DEFAULT SYSDATE);

Which line of this statement will cause an error?
1
2
3
4
1
GROUPING()
GROUPING distinguishes superaggregate rows from regular grouped rows. GROUP BY
extensions such as ROLLUP and CUBE produce superaggregate rows where the set of all values is represented by null. Using the GROUPING function, you can distinguish a null representing the set of all values in a superaggregate row from a null in a regular row.

The expr in the GROUPING function must match one of the expressions in the GROUP BY clause. The function returns a value of 1 if the value of expr in the row is a null representing the set of all values. Otherwise, it returns zero. The data type of the value returned by the GROUPING function is Oracle NUMBER
What is the default sort order when using an ORDER BY clause?
ascending
James works as a Database Developer for Bluewell Inc. The company has a SQL Server
database named Department. The Department database has a table named Employee
that contains information of all the employees who work in their respective departments.

There are six departments in the company: Marketing, Production, Sales, Accounts,
Purchase, and Finance. An employee can work in more than one department. James wants to retrieve the Emp_ID, FirstName, and LastName columns of those employees who work in either Dallas or Houston.

Which of the following SELECT statements can James use to accomplish the task?

Each correct answer represents a complete solution. Choose all that apply.

A: SELECT ID, FirstName, LastName
WHERE UPPER(City) IN 'DALLAS' OR 'HOUSTON' FROM Employee

B: SELECT * FROM Employee
WHERE UPPER(City) LIKE 'DALLAS' OR 'HOUSTON'

C: SELECT ID, FirstName, LastName
FROM Employee
WHERE UPPER(City) LIKE 'DALLAS' OR UPPER(City) LIKE 'HOUSTON'

D: SELECT ID, FirstName, LastName
FROM Employee
WHERE UPPER(City) IN ('DALLAS', 'HOUSTON')
C: SELECT ID, FirstName, LastName
FROM Employee
WHERE UPPER(City) LIKE 'DALLAS' OR UPPER(City) LIKE 'HOUSTON'

D: SELECT ID, FirstName, LastName
FROM Employee
WHERE UPPER(City) IN ('DALLAS', 'HOUSTON')
Group Funhctions can be used only with the SQL statement that has the GROUP BY clause - Correct or Incorrect ?
Incorrect
Which group function would you use to determine the number of rows that meet a certain condition?
COUNT(*)
Consider the statements given below:

SQL> CREATE ROLE R1;
Role created

SQL> GRANT INSERT ON EMP TO R1;
Grant succeeded

SQL> GRANT UPDATE ON EMP TO R1;
Grant succeeded

SQL> GRANT DELETE ON EMP TO R1;
Grant succeeded

SQL> GRANT R1 TO SCOTT;
Grant succeeded

SQL> GRANT R1 TO BLAKE;
Grant succeeded

If you want to revoke only INSERT and DELETE on EMP from SCOTT, how will you achieve
this task?

A: REVOKE R1 FROM SCOTT;
GRANT UPDATE ON EMP TO SCOTT;

B: REVOKE INSERT ON EMP FROM R1;
REVOKE DELETE ON EMP FROM R1;

C: REVOKE R1 FROM SCOTT;

D: REVOKE INSERT ON EMP FROM SCOTT;
REVOKE DELETE ON EMP FROM SCOTT;
A: REVOKE R1 FROM SCOTT;
GRANT UPDATE ON EMP TO SCOTT;
Which meta characters enables you to match one or more occurrences of an expression?
+
Which of the following regular expression functions search a given pattern in the source
string and returns the row(s) that satisf(ies)y the specified condition?

Each correct answer represents a complete solution. Choose all that apply

A: REGEXP_SUBSTR
B: REGEXP_REPLACE
C: REGEXP_LIKE
D: REGEXP_INSTR
A: REGEXP_SUBSTR
C: REGEXP_LIKE
The ID column in the CUSTOMER table that corresponds to the CUSTOMER_ID column of the CURR_ORDER table contains null values for rows that need to be displayed. Which type of join should you use to display the data?
outer join
View the Exhibit and examine DEPARTMENTS and the LOCATIONS tables.

Evaluate the following SOL statement:

SELECT location_id, city FROM locations
I WHERE NOT EXISTS (SELECT location_id
FROM departments WHERE location_id <>

A. The statement would execute and would return the desired results.

B. The statement would not execute because the = comparison operator is missing in the WHERE
clause of the outer query.

C. The statement would execute but it will return zero rows because the WHERE clause in the
inner query should have the = operator instead of <>.

D. The statement would not execute because the WHERE clause in the outer query is missing the
column name for comparison with the inner query result
C
What is the default number of decimal positions stored in a timestamp datatype?
6
It calculates super aggregates - Correct or Incorrect about ROLLUP operation ?
Correct
They help in retrieving data from a database table whose rows have a hierarchical relationship - Correct or Incorrect about Hierarchial Queries ?
Correct
Oracle allows up to 255 levels of subqueries in the WHERE clause - True or False in regard to subquery ?
1
TO_CHAR may convert date items to character items - Correct or Incorrect ?
Correct
A subquery used in an INTO clause of a SELECT statement must return only one column, but can return multiple rows - True or False regarding Subquery ?
1
The DBA_TAB_PRIVS data dictionary view allows a user account to see object privileges granted by other user accounts to itself - Correct or Incorrect ?
Correct
The DROP SYNONYM statement removes the synonym, and the status of the table on which the synonym has been created becomes invalid - Correct or Incorrect about SYNONYMS ?
Incorrect
Which specifies the rows returned by a hierarchical query?
LEVEL
How can a subquery make reference to a table in the main query?
Through the use of a table alias
GRANT CREATE TABLE, SELECT ON oe.orders TO emp, - Correct or Incorrect ?
Incorrect - because system privileges and object privileges cannot be granted together in a single GRANT statement
The DROP SYNONYM statement removes the synonym, and the status of the table on which the synonym has been created becomes invalid - Correct or Incorrect about SYNONYMS ?
Incorrect
Which SQL statements will display the time zone offset for US/Alaska time zone?
SELECT TZ_OFFSET ('US/Alaska') FROM DUAL;
Which is a quick way of selecting all columns?
Asterisk (*)
Which option for a column in a CREATE TABLE statement indicates the value that the column should be given if no value is explicitly specified on an INSERT statement?
the DEFAULT option
If a table or the base table of a view contains one or more domain index columns,then this statement executes the appropriate indextype update routine - Correct or Incorrect about UPDATE statements ?
Correct
Only two columns may be compared between the parent and the subquery - Correct or Incorrect about the Multiple Column Subquery ?
Incorrect
You are tasked with querying the data dictionary view that lists only those sequences to which you currently have privileges, but don’t necessarily own. To do this, you log in to your own user account and query the data dictionary view called:
ALL_SEQUENCES
What happens when the = operator is used with a multiple-row subquery?
An ORA-01427: single-row subquery returns more than one row error occurs
The SET clause is used to update multiple columns of a table separated by commas - Correct or Incorrect about UPDATE statement ?
Correct
Which keys automatically have indexes?
Primary and unique keys
You work as a Database Administrator for Gadgets Inc. The company uses Oracle as its
database. You want to retrieve the total number of employees whose last_name ends with a letter s.

Which of the following queries will you use to accomplish the task?

Each correct answer represents a complete solution. Choose two.

A: SELECT COUNT (*) FROM employee WHERE SUBSTR (last_name, 1) = 's';

B: SELECT COUNT(*) FROM employee WHERE SUBSTR (last_name, -1) = 's';

C: SELECT COUNT(*) FROM employee WHERE last_name LIKE '%s';

D: SELECT COUNT(*) FROM employee WHERE last_name IN (n, s);
B: SELECT COUNT(*) FROM employee WHERE SUBSTR (last_name, -1) = 's';

C: SELECT COUNT(*) FROM employee WHERE last_name LIKE '%s';
Given below is a list of functions and their purpose in random order.

Function Purpose
1)NVL a) Used for evaluating NOT NULL and NULL values

2)NULLIF b) Used to return the first non- null values in a list of expressions

3)COALESCE c) Used
to compare two expressions. If both are same, it returns NULL; otherwise, it returns only the first expression.

4)NVL2 d) Used to convert NULL values to actual values

Identify the correct combination of functions and their usage.

A. 1-a,2-c,3-b,4-d
B. 1-d,2-c,3-b,4-a
C. 1-b,2-c,3-d,4-a
D. 1-d,2-b,3-c,4-a
B
TO_YMINTERVAL()
TO_YMINTERVAL()

TO_YMINTERVAL converts a character string of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type to an INTERVAL YEAR TO MONTH type.
TO_YMINTERVAL accepts argument in one of the two formats:

■ SQL interval format compatible with the SQL standard (ISO/IEC 9075:2003)
■ ISO duration format compatible with the ISO 8601:2004 standard

The following example calculates for each employee in the sample hr.employees table a date one year two months after the hire date:

SELECT hire_date, hire_date + TO_YMINTERVAL('01-02') "14 months" FROM employees;

HIRE_DATE 14 months
--------- ---------
17-JUN-03 17-AUG-04
21-SEP-05 21-NOV-06
13-JAN-01 13-MAR-02
20-MAY-08 20-JUL-09
21-MAY-07 21-JUL-08
The personnel table contains these columns:

id NUMBER(9)
last_name VARCHAR2(25)
first_name VARCHAR2(25)
manager_id NUMBER(9)
dept_id NUMBER(9)

Evaluate this SQL statement:

SELECT p.dept_id, p.first_name|| ' ' ||p.last_name employee,c.first_name|| ' ' ||c.last_name coworker
FROM personnel p, personnel c WHERE p.dept_id = c.dept_id AND p.id <> c.id;

Which result will the statement provide?

It will display each employee's department number, name, and manager's name.

It will display each employee's department number, name, and all coworkers in the same department.

It will display each department, the manager in each department, and all the employees in each department.

It will return a syntax error.
It will display each employee's department number, name, and all coworkers in the same department.
They can be used along with the single-row function in the SELECT clause of a SQL statement - Correct or Incorrect ?
Correct
Which CREATE TABLE statement is valid?

A. CREATE TABLE ord_details
(ord_no NUMBER(2) PRIMARY KEY,
item_no NUMBER(3) PRIMARY KEY,
ord_date date NOT NULL);

B. CREATE TABLE ord_details
(ord_no NUMBER(2) UNIQUE, NOT NULL,
item_noNUMBER(3),
ord_date date DEFAULT SYSDATE NOT NULL);

C. CREATE TABLE ord_details
(ord_no NUMBER(2) ,
item_noNUMBER(3),
ord_date date DEFAULT NOT NULL,
CONSTRAINT ord_uq UNIQUE (ord_no),
CONSTRAINT ord_pk PRIMARY KEY (ord_no));

D. CREATE TABLE ord_details
(ord_no NUMBER(2),
item_noNUMBER(3),
ord_date date DEFAULT SYSDATE NOT NULL,
CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));
D
Which of the following syntaxes is used to specify that multiple levels of grouping should be computed at once?
ROLLUP
The service table contains these columns:

id NUMBER Primary Key
service-date DATE
technician_id NUMBER
description VARCHAR2(50)

Which SELECT statement could you use to display the number of times each technician performed a service between January 1, 2008 and June 30, 2008?

SELECT COUNT(*)
FROM service
WHERE service_date BETWEEN '01-JAN-2008' AND '30-JUN-2008' GROUP BY service_date;

SELECT COUNT(service_date)
FROM service
WHERE service_date BETWEEN '01-JAN-2008' AND '30-JUN-2008' GROUP BY service_date;

SELECT technician_id, service_date, COUNT(*)
FROM service
WHERE service_date BETWEEN '01-JAN-2008' AND '30-JUN-2008' ORDER BY technician_id, service_date;

SELECT technician_id, COUNT(technician_id)
FROM service
WHERE service_date BETWEEN '01-JAN-2008' AND '30-JUN-2008' GROUP BY technician_id;
SELECT technician_id, COUNT(technician_id)
FROM service
WHERE service_date BETWEEN '01-JAN-2008' AND '30-JUN-2008' GROUP BY technician_id;
Evaluate the following expression using meta character for regular expression: '[^Ale|ax.r$]' Which matches would be returned by this expression?
Alexender / Alaxendar
The po_detail table was created using this
CREATE TABLE statement:

CREATE TABLE po_detail
(po_num NUMBER NOT NULL,
po_line_id NUMBER NOT NULL,
product_id NUMBER NOT NULL,
quantity NUMBER(3) NOT NULL,
unit_price NUMBER (5,2) DEFAULT 0,
PRIMARY KEY( po_num, po_line_id),
FOREIGN KEY (po_num) REFERENCES PO_HEADER(po_num),
FOREIGN KEY (product_id) REFERENCES product(product_id),
CHECK (unit_price BETWEEN 0 and 9999.99))
TABLESPACE USERS;

Which two INSERT statements will execute successfully? (Choose two.)

INSERT INTO po_detail (po_num, po_line_id, product_id, unit_price, quantity)
VALUES ('10056','1','3','400','1052.40');

INSERT INTO po_detail
VALUES (10055,1,2,30,DEFAULT);

INSERT INTO po_detail (po_num, po_line_id, product_id, quantity, unit_price)
VALUES (10052,2,3, 200, NULL);

INSERT INTO po_detail VALUES (10056,1,3,400,52.40);

INSERT INTO po_detail VALUES (10055,1,2,NULL,NULL);
INSERT INTO po_detail
VALUES (10055,1,2,30,DEFAULT);

INSERT INTO po_detail VALUES (10056,1,3,400,52.40);
The parent query can reference the columns specified in the subquery - Correct or Incorrect about Correlated Subquery ?
Incorrect
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database.

The database contains a table named Employee.

You issue the following SQL statement:

SELECT emp_name, SUM(salary)
FROM employee
WHERE SUM(salary) >6000
GROUP BY emp_name;

Which of the following lines will generate an error message?

A: Line 3
B: Line 2
C: Line 1
D: Line 4
A: Line 3
It is read only - Correct or Incorrect about Oracle Data Dictionary ?
Correct
Where You can use regular expression function ?
Anywhere you can use a SQL function of a comparable datatype
It is used to identify the NULL value in the aggregate functions - Correct or Incorrect about GROUPING function ?
Incorrect
There can be only root row in the hierarchy - Correct or Incorrect about Hierarchial Queries ?
Incorrect
Which clause can you include in a CREATE VIEW statement to ensure that DML operations that would change the result of the view are not allowed?
WITH CHECK OPTION
If you wish to display a numeric value with dollar signs and commas, which is the best approach to take?
The TO_CHAR function with a format model
Which construct can be used to return data based on an unknown condition?
a subquery
If the sub query returns 0 rows, then the value returned by the sub query expression is NULL - True or False ?
1
A B-tree reduces the query execution time - Correct or Incorrect about B-Tree Index ?
Correct
If you query the USER_CONSTRAINTS data dictionary view for checking the constraints on T1 table, what will be the value of the CONSTRAINT_TYPE column for the NOT NULL constraint T1_NN?
C
Which keywords is used in the syntax of the system privilege to indicate that a user can perform the privilege on any objects owned by any other user except for SYS?
ANY
Which statements should be issued to make a visible index invisible?
ALTER INDEX index INVISIBLE;
Which of the following conversion functions is used to convert raw to a character value containing its hexadecimal equivalent?
RAWTOHEX
Which system privilege may not be granted to a role?
ALTER / EXECUTE / REFERENCES
Which of the following statements can be said of the SELECT statement’s WHERE clause?
It specifies which rows are to be returned from the table, It is optional
The ORDER BY clause can be used in the subquery -True or False regarding Subqueries ?
1
Which is used to view all the columns of an existing table?
The USER_TAB_COLUMNS system view
The WITH query_name clause allows a user to assign a name to a subquery block - Correct or Incorrect ?
Correct
Advantages of using Flashback Data Archive for historical data tracking ---
Application Transparent / Seamless Access / Security / Minimal performance overhead / Storage Optimized / Centralized Management
Which statement would you use to define a default value for an existing column?
ALTER TABLE. You would also use the ALTER TABLE statement to add, modify, or drop columns.
Which statements is used to access and manipulate data in existing tables?
Data manipulation language
The difference between dropping a column from a table with DROP and setting a column to be UNUSED is:
The UNUSED column and its data are retained within the table’s storage allocation and counts against the total limit on the number of columns the table is allowed to have.
How do you insure that values entered in the salary column of the employee table must always be greater than $30,000?
Use a check constraint indicating salary > 30000
SYSTIMESTAMP()
SYSTIMESTAMP()

SYSTIMESTAMP returns the system date, including fractional seconds and time zone,
of the system on which the database resides. The return type is TIMESTAMP WITH TIME ZONE.
SIGN()
SIGN()

SIGN returns the sign of n. This function takes as an argument any numeric data type,or any nonnumeric data type that can be implicitly converted to NUMBER, and returns
NUMBER.

For value of NUMBER type, the sign is:
■ -1 if n<0
■ 0 if n=0
■ 1 if n>0

For binary floating-point numbers (BINARY_FLOAT and BINARY_DOUBLE), this
function returns the sign bit of the number. The sign bit is:
■ -1 if n<0
■ +1 if n>=0 or n=NaN

The following example indicates that the argument of the function (-15) is <0:

SELECT SIGN(-15) "Sign" FROM DUAL;

Sign
----------
-1
You are the DBA for a new shopping portal still in its beta stage and which does not yet include any client-side validation. While ordering products, some users in San Francisco have entered their city codes incorrectly as 'SanFr'. The correct value for city code for those living in San Francisco is 'SF'. You need to find the rows with the incorrect city code of 'SanFr' and then change them to the correct city code of 'SF'.

Which of the following statements should you use to achieve the desired results?

UPDATE users_info
SET city_code='SF'
WHERE NOT REGEXP_LIKE(city_code, 'SF');

UPDATE users_info
SET city_code='SF'
WHERE REGEXP_LIKE(city_code, 'SF');

UPDATE users_info
SET city_code='SF'
WHERE NOT REGEXP_LIKE(city_code, 'SanFr');

UPDATE users_info
SET city_code='SF'
WHERE REGEXP_LIKE(city_code, 'SanFr');
UPDATE users_info
SET city_code='SF'
WHERE REGEXP_LIKE(city_code, 'SanFr');
Which part of the query given below will be executed and processed first?

SELECT * FROM SUPPLIER_GOOD
UNION
SELECT * FROM SUPPLIER_TEST
MINUS
SELECT * FROM SUPPLIER;

A: Both operators are executed together
B: UNION operator
C: MINUS operator
D: Last compound query is executed first
B: UNION operator
When the MIN group function is used with a DATE column, which date is displayed?
the earliest date
You maintain the database for a resort hotel. The details of the hotel rooms need to be maintained in a database.
For this, you execute the following statements:

CREATE TABLE roomdetails
(
roomnum NUMBER(5),
occupancy NUMBER(5),
roomtype VARCHAR(30)
);

INSERT INTO roomdetails VALUES (344, 1, 'Single');

INSERT INTO roomdetails VALUES (196, NULL,'Single');

ALTER TABLE roomdetails ADD CONSTRAINT un_rnum UNIQUE(roomnum) DISABLE NOVALIDATE;

ALTER TABLE roomdetails MODIFY roomtype NOT NULL ENABLE;

INSERT INTO roomdetails VALUES (231, NULL, 'Single');

INSERT INTO roomdetails VALUES (196,2 , 'Double');

INSERT INTO roomdetails VALUES (11, 2, NULL);

Based on the given statements, how many rows are inserted in the roomdetails table after the un_rnum and NOT NULL constraints are added?

0
1
2
3
2
A CHECK constraint cannot be defined on a view - Correct or Incorrect ?
Correct
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database.

You have issued the CREATE TABLE command to create a table named Employee.

You use the following code-line to accomplish the task:

CREATE TABLE @EMP
(EMP_ID NUMBER, EMP_NAME VARCHAR2 (12), EMP_ADD VARCHAR (30),
EMP_DEP NUMBER, SALARY NUMBER);

The desired table is not created and an error message is returned.

Which of the following is the cause of the error message?

A: The table name starts with a special character.

B: The command used to create the table is inappropriate.

C: The data types used for every columns are inappropriate.

D: The statement ends with a semi-colon (;).
A: The table name starts with a special character
The WITH clause improves the performance of the queries - Correct or Incorrect about the WITH clause ?
Correct
Evaluate the following command:

CREATE TABLE employees
(employee_id NUMBER(2) PRIMARY KEY,
last_name VARCHAR2(25) NOT NULL,
department_idNUMBER(2), job_id VARCHAR2(8),
salaryNUMBER(10,2));

You issue the following command to create a view that displays the IDs and last names of the
sales staff in the organization:

CREATE OR REPLACE VIEW sales_staff_vu AS
SELECT employee_id, last_name job_id
FROM employees
WHERE job_id LIKE 'SA_%' WITH CHECK OPTION;

Which statements are true regarding the above view? (Choose all that apply.)

A. It allows you to insert details of all new staff into the EMPLOYEES table.

B. It allows you to delete the details of the existing sales staff from the EMPLOYEES table.

C. It allows you to update the job ids of the existing sales staff to any other job id in the
EMPLOYEES table.

D. It allows you to insert the IDs, last names and job ids of the sales staff from the view if it is used
in multitable INSERT statements
B,D
Which may not be used within a parameter of the REGEXP_LIKE function?
‘%’ as a wildcard operator
It can only be used with the ROLLUP and CUBE operators specified in the GROUP BY clause - Correct or Incorrect about GROUPING function ?
Correct
When the MAX group function is used with a NUMBER column, which number is displayed?
the largest number
Examine the structures of the po_header and po_detail tables:

po_header
--------------------
po_num NUMBER NOT NULL
po_date DATE DEFAULT SYSDATE
po_total NUMBER(9,2)
supplier_id NUMBER(9)
po_terms VARCHAR2(25)

po_detail
------------------
po_num NUMBER NOT NULL
po_line_id NUMBER NOT NULL
product_id NUMBER NOT NULL
quantity NUMBER(3) NOT NULL,
unit_price NUMBER (5,2) DEFAULT 0

The primary key of the po_header table is po_num. The primary key of the po_detail table is the combination of po_num and po_line_id. A FOREIGN KEY constraint is defined on the po_num column of the po_detail table that references the po_header table.

You want to update the purchase order total amount for a given purchase order. The po_total column in the po_header table should equal the sum of the extended amounts of the corresponding po_detail records. You want the user to be prompted for the purchase order number when the query is executed. When a purchase order is updated, the po_date column should be reset to the current date.

Which UPDATE statement should you execute?

UPDATE po_header
SET po_total = (SELECT SUM(ext)
FROM (SELECT po_num, quantity * unit_price ext
FROM po_detail
WHERE po_num = &&ponum)),
SET po_date = sysdate
WHERE po_num = &&ponum;

UPDATE po_header
SET po_total = (SELECT SUM(quantity * unit_price) FROM (SELECT po_num)
FROM po_detail
WHERE po_num = &&ponum)),
po_date = DEFAULT
WHERE po_num = &&ponum;

UPDATE po_header
SET po_total = (SELECT SUM(ext)
FROM (SELECT po_num, quantity * unit_price ext
FROM po_detail WHERE po_num = &&ponum)),

UPDATE po_header
SET po_date = sysdate
WHERE po_num = &&ponum;

UPDATE po_header
SET po_total = (SELECT SUM(ext)
FROM (SELECT po_num, quantity * unit_price ext
FROM po_detail WHERE po_num = &&ponum)),
po_date = DEFAULT
WHERE po_num = &&ponum;

UPDATE po_header
SET po_total = (SELECT po_num, SUM(ext)
FROM (SELECT po_num, quantity * unit_price ext
FROM po_detail WHERE po_num = &&ponum)),
po_date = DEFAULT
WHERE po_num = &&ponum;

UPDATE po_header
SET po_total = (SELECT SUM(ext)
FROM (SELECT po_num, quantity * unit_price ext
FROM po_detail WHERE po_num = &&ponum)),
po_date = NULL WHERE po_num = &&ponum;
UPDATE po_header
SET po_total = (SELECT SUM(ext)
FROM (SELECT po_num, quantity * unit_price ext
FROM po_detail WHERE po_num = &&ponum)),
po_date = DEFAULT WHERE po_num = &&ponum;
Which clauses actually links the rows of a table in a hierarchical tree structure?
CONNECT BY PRIOR <condition>
Which option can you include with the CREATE VIEW statement to prevent DML through the view?
The WITH READ ONLY option of the CREATE VIEW statement
What is the purpose of the START WITH <column name> IS NULL clause in a hierarchical query?
Hierarchical queries that should begin at the very top of the hierarchy will often have a NULL value for <column name> since that column often will be the name of the parent, and the top row of the query does not have a parent.
Multiple-row subqueries always contain a subquery within a subquery - True or False ?
1
Which comparison operator be used with multiple-row subqueries?
ALL, ANY, IN, NOT IN, >=ALL
A date value may be converted to a character string using the TO_CHAR function - True or False ?
1
TIMESTAMP WITH TIME ZONE -- stores value of ---
2008-06-15 8:00:00 -8:00'
Oracle has system privileges that allow local access rights - Correct or Incorrect about Privileges ?
Incorrect
Sequence numbers are generated independently of tables - Correct or Incorrect about Sequences ?
Correct
It contains the current system privileges available in the user session- Correct or Incorrect about the SESSION_PRIVS dictionary view ?
Correct
Which is used to fetch rows from a SELECT statement.
Cursor
How many levels can subqueries be nested in a FROM clause?
unlimited
It is not possible to delete rows with the help of a view if the DISTINCT clause is present in the view definition - Correct or Incorrect about a VIEW ?
Correct
Constraint - Is it a Database Object ? - Yes or No
Yes
The datatypes of the columns being compared must match - Correct or Incorrect about Multiple Column subquery ?
Correct
Which of the following clauses is used in a query block to represent a set of data that is being repeatedly used in a complex query?
WITH
Which statement would you use to add a PRIMARY KEY constraint to a table?
ALTER TABLE ADD CONSTRAINT
Which commands can be rolled back?
DELETE / INSERT / MERGE / UPDATE
Which operator combines two character strings yielding one combined character string?
|| (the concatenation operator)
Which of the following retention periods is valid if the command at SQL prompt is as follows: ALTER db_flashback_retention_target = 4320;
3 days
What is the benefit to setting a column that you no longer want in your table to UNUSED, rather than just dropping the column?
Improved performance
SUM()
SUM()

SUM returns the sum of values of expr. You can use it as an aggregate or analytic function.
This function takes as an argument any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. The function returns the same data type as the numeric data type of the argument.
Which system privilege allows a user to connect to the database?
CREATE SESSION
SELECT product_name, list_price, min_price, list_price - min_price Difference FROM
product_information

Which options when used with the above SQL statement can produce the sorted output in
ascending order of the price difference between LIST_PRICE and MIN_PRICE? (Choose all that
apply.)

A. ORDER BY 4
B. ORDER BY MIN_PRICE
C. ORDER BY DIFFERENCE
D. ORDER BY LIST_PRICE
E. ORDER BY LIST_PRICE - MIN_PRICE
A,C,E
What will be the output of the following query?

SELECT ABS(FLOOR(-268651.894)) FROM DUAL;

A: 268651
B: -268652
C: 268652
D: Oracle Error
C: 268652
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database.

You use the CREATE TABLE command to create a table named Employee.

The syntax to create the table is given below:

1.CREATE TABLE Employee;
2.(Emp_ID NUMBER(8)
3.CONSTRAINT Emp_pk PRIMARY KEY,
4. 2007_Emp_Amt NUMBER(8,2),
5. Emp_Type VARCHAR2(24)
6. CONSTRAINT Emp_Cons NOT NULL,
7. Emp_Amt_07 NUMBER(8,4));

The syntax fails to create the table. Which of the following lines are incorrect?

Each correct answer represents a complete solution. Choose all that apply.

A: Line 7
B: Line 4
C: Line 1
D: Line 3
E: Line 2
F: Line 6
G: Line 5
B: Line 4
C: Line 1
You are tasked to identify the position of a given pattern within a larger string. Which functions will you be sure to use?
REGEXP_INSTR
NUMTODSINTERVAL()
NUMTODSINTERVAL()

NUMTODSINTERVAL converts n to an INTERVAL DAY TO SECOND literal. The argument n can be any NUMBER value or an expression that can be implicitly converted to a NUMBER value. The argument interval_unit can be of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type. The value for interval_unit specifies the unit of n and must resolve to one of the following string values:
■ 'DAY'
■ 'HOUR'
■ 'MINUTE'
■ 'SECOND'

interval_unit is case insensitive. Leading and trailing values within the parentheses are ignored. By default, the precision of the return is 9.
A scalar subquery may not be used in which of the following clauses and/or SQL statements?
The GROUP BY clause of a SELECT statement
Evaluate the following SQL statement:

SELECT product_name || 'it's not present in the stock'
FROM product_information
WHERE product_status = 'obsolete';

On executing the above query, you received the following error message:

ERROR
ORA-01756: quoted string not properly terminated

What should you do to execute the query successfully?

A: Enclose the character literal string in the SELECT clause within the double quotation
marks.

B: Use Quotes (q) operator and delimiter to allow the use of the single quotation mark in the literal character string.

C: Use escape character to negate the single quotation mark inside the literal character
string in the SELECT clause.

D: Do not enclose the character literal strings in the SELECT clause within the single quotation marks.
B: Use Quotes (q) operator and delimiter to allow the use of the single quotation mark in the literal character string.
Which characters anchors the expression to the start of a line?
^
When a GROUP BY clause and no ORDER BY clause is used, in what order does the Oracle server implicitly sort the results?
in ascending order by the first grouping column
You work as a Database Administrator for Gadgets Inc. The company uses Oracle as its
database. You created a sequence by using the following syntax:

SELECT sequence_name, min_value, max_value, increment_by, last_number
FROM user_sequences;

Which of the following statements represents the significance of the last_number column?

A: The last_number column displays the next available sequence number if NOMINVALUE is specified.

B: The last_number column displays the next available sequence number if NOCYCLE is
specified.

C: The last_number column displays the next available sequence number if NOCACHE
is specified.

D: The last_number column displays the next available sequence number if NOMAXVALUE is specified.
C: The last_number column displays the next available sequence number if NOCACHE is specified.
What is the function of the NOCYCLE keyword in a hierarchical query?
It prevents the query from aborting at run time due to an infinite loop
Which should a user do to perform an unconditional multitable insert?
Specify ALL followed by multiple insert_into_clauses.
Which statement removes a sequence from the data dictionary?
DROP SEQUENCE sequence_name;
Which of the following queries will provide details of all the constraints and column names on which they are created for the EMP table owned by SCOTT user?

A: SELECT CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, COLUMN_NAME FROM DBA_CONSTRAINTS
WHERE OWNER='SCOTT' AND TABLE_NAME='EMP';

B: SELECT OBJECT_NAME, OBJECT_TYPE, TABLE_NAME, COLUMN_NAME FROM DBA_OBJECTS WHERE OWNER='SCOTT'
AND TABLE_NAME='EMP' AND OBJECT_TYPE='CONSTRAINT';

C: SELECT CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, COLUMN_NAME FROM DBA_CONS_COLUMNS
WHERE OWNER='SCOTT' AND TABLE_NAME='EMP';

D: SELECT A.CONSTRAINT_NAME, A.CONSTRAINT_TYPE, A.TABLE_NAME,
B.COLUMN_NAME FROM DBA_CONSTRAINTS A, DBA_CONS_COLUMNS B WHERE A.OWNER='SCOTT' AND A.OWNER=B.OWNER
AND .CONSTRAINT_NAME=B.CONSTRAINT_NAME AND A.TABLE_NAME='EMP';
D: SELECT A.CONSTRAINT_NAME, A.CONSTRAINT_TYPE, A.TABLE_NAME,
B.COLUMN_NAME FROM DBA_CONSTRAINTS A, DBA_CONS_COLUMNS B WHERE A.OWNER='SCOTT'
AND A.OWNER=B.OWNER AND A.CONSTRAINT_NAME=B.CONSTRAINT_NAME
AND A.TABLE_NAME='EMP';
Which is a function that is used to convert a timestamp value and a time zone to a TIMESTAMP WITH TIME ZONE value?
FROM_TZ
Outer join conditions CANNOT use which logical operator?
the IN logical operator
Multiple-row subqueries can be used to retrieve multiple rows from a single table only - True or False ?
1
What are the distinguishing characteristics of a scalar subquery?
A scalar subquery returns one row & One column
The NVL single-row function can be used on VARCHAR2 columns - True or false ?
1
You are tasked to work with a view. The view’s underlying table has been altered. What information can the data dictionary provide at this point?
The status of the view so that you can determine if the view requires recompilation / The current state of the table / The query that was used to create the view. / The names of columns in the underlying table.
Synonyms can be created for tables but not views - Correct or Incorrect about SYNONYMS ?
Incorrect
Roles can be granted to other roles - Correct or Incorrect about ROLES ?
Correct
Where could subqueries be used in a SELECT statement ?
SELECT_LIST, FROM, WHERE, GROUP BY, HAVING
For which database objects can you create a synonym?
Sequences / Another synonym / User defined object types / Views
How many PRIMARY KEY constraints can be defined on a table?
only one
DBTIMEZONE()
DBTIMEZONE returns the value of the database time zone. The return type is a time zone offset (a character type in the format '[+|-]TZH:TZM') or a time zone region name, depending on how the user specified the database time zone value in the most recent CREATE DATABASE or ALTER DATABASE statement.

The following example assumes that the database time zone is set to UTC time zone:

SELECT DBTIMEZONE FROM DUAL;

DBTIME
------
+00:00
With which clauses can a user use the WITH clause?
SELECT
Assuming you have the appropriate object privileges, how should you access a table owned by another user in a FROM clause?
prefix the table name with the owner/schema name, as in ownername.tablename
When testing for NULL values in a SQL statement, which comparison operator should you use?
the IS NULL comparison operator
What would be the most common reason for an error message if you attempted to drop a primary key constraint on a table?
The reason for the error would be that the column that had the primary key constraint on it was also acting as the parent in a parent / child relationship.
Unique constraints can be defined in either a CREATE TABLE statement or an ALTER TABLE statement - True or False ?
1
A constraint is enforced only for the INSERT operation on a table - Correct or Incorrect regarding Constraints ?
Incorrect
Which can be identified by a password?
Users / Roles
Which data dictionary views store information about all the objects in the data dictionary?
DBA_*
Which statement creates a marker in the current transaction to allow you to rollback only a portion of the changes within the transaction?
SAVEPOINT. The syntax is SAVEPOINT name;
Consider the following expression:

INTERVAL '540' DAY(3) - INTERVAL '480' HOUR - INTERVAL '15 12:30' DAY TO MINUTE +
INTERVAL '12:30' HOUR TO MINUTE

Which of the following represent the values of the given expression? (Choose two.)

INTERVAL '12120' HOUR(5)

INTERVAL '505' DAY(3)

INTERVAL '576-1' DAY TO HOUR

INTERVAL '504 23:00' DAY TO MINUTE
INTERVAL '12120' HOUR(5)

INTERVAL '505' DAY(3)
Which of the following options should you use to insert data into the Name column only
of the T1 table?

A: INSERT INTO T1(NAME) VALUES('ADAM KINGER');

B: INSERT INTO T1 VALUES(NULL);

C: INSERT INTO T1 VALUES(NULL,'ADAM KINGER');

D: INSERT INTO T1 VALUES('ADAM KINGER',NULL);
A: INSERT INTO T1(NAME) VALUES('ADAM KINGER');

C: INSERT INTO T1 VALUES(NULL,'ADAM KINGER');
RTRIM()
RTRIM()

RTRIM removes from the right end of char all of the characters that appear in set.

This function is useful for formatting the output of a query.

If you do not specify set, then it defaults to a single blank. If char is a character literal, then you must enclose it in single quotation marks. RTRIM works similarly to LTRIM.

Both char and set can be any of the data types CHAR, VARCHAR2, NCHAR,NVARCHAR2, CLOB, or NCLOB. The string returned is of VARCHAR2 data type if char is a character data type, NVARCHAR2 if expr1 is a national character data type, and a LOB if char is a LOB data type

The following example trims all the right-most occurrences of less than sign (<),greater than sign (>) , and equal sign (=) from a string:

SELECT RTRIM('<=====>BROWNING<=====>', '<>=') "RTRIM Example" FROM DUAL;

RTRIM Example
---------------
<=====>BROWNING
If the subquery returns no rows, then the value is considered to be NULL - Correct or Incorrect about Scaler subqueries ?
Correct
You work as a Database Administrator for Amtech Inc. The company uses Oracle as its
database. The database contains a table named Employee. You want to retrieve all records except the record of an employee whose emp_id is equal to 6 in the Employee table.

Which of the following SQL queries will you use to accomplish the task?

Each correct answer represents a complete solution. Choose two

A: SELECT * FROM employee
WHERE emp_id IS 6;

B: SELECT * FROM employee
WHERE emp_id <>6;

C: SELECT *FROM employee
WHERE emp_id !=6;

D: SELECT * FROM employee
WHERE emp_id NOT EQUAL 6;
B: SELECT * FROM employee
WHERE emp_id <>6;

C: SELECT *FROM employee
WHERE emp_id !=6;
Which SQL commands can be used to define a CHECK constraint?
ALTER TABLE
Which clause of a SELECT statement does Oracle server evaluate last?
the ORDER BY clause
You work as a Database Developer for Gadgets Inc. The company uses Oracle as its
database. The database contains a table named Employee.

You issue the following query against the
Employee table:

SELECT Department_id, COUNT(last_name)
FROM Employee;

Which of the following statements is true about the above mentioned query?

A: It will retrieve the department IDs of those employees whose count of the last name
exists.

B: It will retrieve the department IDs of those employees whose last name column exists and has a NULL value.

C: It will retrieve the department IDs of all employees.

D: It will return an error message.
D: It will return an error message.
You cannot specify a table collection expression when performing a multitable insert - Correct or Incorrect ?
Correct
What should you do to eliminate the need for all database users to qualify an object name with its schema name?
Create a public synonym using CREATE PUBLIC SYNONYM syn_name FOR obj_name;
The employee table contains these columns:

emp_id NUMBER(9)
fname VARCHAR2(25)
lname VARCHAR(30)
salary NUMBER(7,2)
bonus NUMBER(5,2)
dept_id NUMBER(9)

You need to calculate the average bonus for all the employees in each department. The average should be calculated based on all the rows in the table even if some employees do not receive a bonus.

Which group functions should you use to calculate this value? (Choose two.)

AVG
SUM
MEAN
NVL
COUNT
AVERAGE
AVG
NVL
When using the LIKE operator, which option must you include to use the percent (%) and underscore (_) characters as literal values?
The ESCAPE option identifies a special escape character that when preceding these characters causes them to be interpreted literally
Which functions is used to format hierarchical data?
LPAD
You work as a Database Administrator for uCertify Inc. The company uses Oracle as its database. The database has a table named Employee that holds information of all the employees of the company. You have moved the table to some other location for maintenance purpose. A user has fired a SELECT query against the table. What will happen in such a scenario?

A: The SELECT query fired against the table will drop the table.

B: An error message will be generated.

C: The query will succeed with reduced performance.

D: The consequence depends on the SKIP_UNUSABLE_INDEXES parameter.
D: The consequence depends on the SKIP_UNUSABLE_INDEXES parameter
It displays the grand total last - Correct or Incorrect about CUBE operator ?
Incorrect
It produces higher-level subtotals, moving from left to right through the list of grouping columns specified in the GROUP BY clause - Correct or Incorrect reharding ROLLUP operator ?
Incorrect
Multiple-Row subqueries use the <ALL> operator to imply less than the maximum - True or False ?
1
A date value may be converted to a character value using the TO_DATE function - True or False ?
1
Single-row Functions can operate on multiple rows of a dataset at a time - True or False ?
1
A user can be granted only one role at any point of time - Correct or Incorrect about ROLES ?
Incorrect
What is the name for a SELECT statement that is embedded in another SELECT statement?
a subquery
Which restricts a user from removing a row from a view?
A GROUP BY clause / Group functions, such as SUM, MIN, MAX, AVG. / The DISTINCT keyword
TO_BLOB()
TO_BLOB()

TO_BLOB converts LONG RAW and RAW values to BLOB values.

From within a PL/SQL package, you can use TO_BLOB to convert RAW and BLOB
values to BLOB.
When the view already exists, using the OR REPLACE option requires the regranting of the object privileges previously granted on the view - Correct or Incorrect concerning the creation of a view ?
Incorrect
Which statement removes all rows from a table while releasing all or most of the storage space used by the table?
the TRUNCATE TABLE statement
Parentheses can be used in an equation to do which of the following?
Override the rules of operator precedence.
The DESCRIBE, or DESC, command, can be used to do which of the following?
Show a table’s columns and the datatypes of those columns
Which files are backed up in the flash recovery area when the BACKUP RECOVERY AREA and BACKUP RECOVERY FILES commands are in use?
Data files
DESCRIBE is which type of command ?
SQL*Plus command
A composite unique key cannot have more than 32 columns - Correct or Incorrect about UNIQUE constraints ?
Correct
If a scalar sub-query evaluates to 0 row, i.e. the sub-query result set is no rows selected, then what value will the sub-query return to the outer query?
NULL
ALTER TABLE products DROP COLUMN discount ADD COLUMN (servicetax NUMBER(10); - Correct or Incorrect ?
Incorrect
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. You want to view all the object privileges granted to a database user on some specific columns of a table.

Which of the following data dictionary views will you use to accomplish the task?

Each correct answer represents a complete solution. Choose two.

A: ALL_COL_PRIVS_RECD
B: DBA_IND_COLUMNS
C: USER_OBJECTS
D: USER_COL_PRIVS_RECD
E: USER_SOURCE
A: ALL_COL_PRIVS_RECD
D: USER_COL_PRIVS_RECD
UPPER()
UPPER()


UPPER returns char, with all letters uppercase. char can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The return value is the same data type as char. The database sets the case of the characters based on the binary mapping defined for the underlying character set.

The following example returns each employee's last name in uppercase:

SELECT UPPER(last_name) "Uppercase"
FROM employees;
View the Exhibit and examine the description of the EMPLOYEES table.

Evaluate the following SQL statement:

SELECT first_name, employee_id, NEXr_DAY(ADD_MONTHS(hire_date, 6), 1) "Review" FROM
employees;

The query was written to retrieve the FIRST_NAME, EMPLOYEE_ID, and review date for employees.

The review date is the first Monday after the completion of six months of the hiring. The
NLS_TERRITORY parameter is set to AMERICA in the session.

Which statement is true regarding this query?

A. The query would execute to give the desired output.

B. The query would not execute because date functions cannot be nested.

C. The query would execute but the output would give review dates that are Sundays.

D. The query would not execute because the NEXT_DAY function accepts a string as argument
C
You are the DBA in the service of the British Royal Museum. You need to update the database of all citizens who have been knighted in the past. You want to build in a validation on the data to find all these people.

Which of the following metacharacter combinations would you use?

'Sir .'
'Sir +'
'Sir ?1'
'Sir EG*1'
'Sir .'
Which group function calculates a standard deviation for a group of values?
STDDEV
Which SQL statement will you use to display a message in the following format?

Outer1 Inner1 Inner2

Here, Outer1, Inner1, and Inner2 are the first, second, and third elements of the
message, respectively.

A: SELECT CONCAT('Outer1' || 'Inner1' || 'Inner2') FROM DUAL;

B: SELECT CONCAT('Outer1', 'Inner1', 'Inner2') FROM DUAL;

C: SELECT CONCAT("Outer1", CONCAT("Inner1", "Inner2")) FROM DUAL;

D: SELECT CONCAT('Outer1', CONCAT(' Inner1', 'Inner2')) FROM DUAL;
D: SELECT CONCAT('Outer1', CONCAT(' Inner1', 'Inner2')) FROM DUAL;
Which should you use if you want minimal redo information to be generated during the table creation?
NOLOGGING
You work as a Database Administrator for Dolliver Inc. The company's database has a table named EMP that contains the COMM column. This column stores the value of commission received by employees. Some of the values for this column are unknown.

Which of the following queries will return a list of those employees whose commission
values are unknown?

A: SELECT * FROM EMP WHERE COMM=NULL;
B: SELECT * FROM EMP WHERE COMM='';
C: SELECT * FROM EMP WHERE COMM IS NULL;
D: SELECT * FROM EMP WHERE COMM=0;
C: SELECT * FROM EMP WHERE COMM IS NULL;
A user can use the WITH clause only with the SELECT clause - Correct or Incorrect regarding the WITH clause ?
Correct
INTERVAL YEAR TO MONTH -- stores value of ---
'+04-00'
Evaluate the following SQL statements that are issued in the given order:

CREATE TABLE emp
(emp_no NUMBER(2) CONSTRAINT emp_emp_no_pk PRIMARY KEY,
enameVARCHAR2(15),
salaryNUMBER(8,2),
mgr_noNUMBER(2) CONSTRAINT emp_mgr_fk REFERENCES emp);

ALTER TABLE emp
DISABLE CONSTRAINT emp_emp_no_pk CASCADE;

ALTER TABLE emp
ENABLE CONSTRAINT emp_emp_no_pk;

What would be the status of the foreign key EMP_MGR_FK?

A. It would be automatically enabled and deferred.

B. It would be automatically enabled and immediate.

C. It would remain disabled and has to be enabled manually using the ALTER TABLE command.

D. It would remain disabled and can be enabled only by dropping the foreign key constraint and
re-creating it.
C
If the SELECT clause has an aggregate function, then those individual columns without an aggregate function in the SELECT clause should be included in the GROUP BY clause - Correct or Incorrect ?
Correct
It returns 0 for those rows that have NULL values as the data in those rows - Correct or Incorrect about GROUPING FUNCTION ?
Correct
Which clause of the SELECT statement constrains columns that use the GROUPING functions?
the HAVING clause
Which type of join joins a table to itself?
a self join
Which SQL statements will display the current time, in hours, minutes, and seconds, as determined by the operating system on which the database server resides?
SELECT TO_CHAR(SYSDATE, ‘HH:MI:SS’) FROM DUAL;
Which function could be used to return a date without the time portion?
The TRUNC date function returns a date with the time portion of the day truncated to the specified format unit. If no 'fmt' (format model) is provided, the date is truncated to the nearest day.
Indexes provide fast access to table data - Correct or Incorrect about Indexes ?
Correct
TO_DATE()
TO_DATE()

TO_DATE converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type to a value of DATE data type.

The fmt is a datetime model format specifying the format of char. If you omit fmt, then char must be in the default date format. The default date format is determined implicitly by the NLS_TERRITORY initialization parameter or can be set explicitly by
the NLS_DATE_FORMAT parameter. If fmt is J, for Julian, then char must be an integer.

The 'nlsparam' argument specifies the language of the text string that is being converted to a date. This argument can have this form:

'NLS_DATE_LANGUAGE = language'

Do not use the TO_DATE function with a DATE value for the char argument. The first two digits of the returned DATE value can differ from the original char, depending on fmt or the default date format.

This function does not support CLOB data directly. However, CLOBs can be passed in
as arguments through implicit data conversion

The following example converts a character string into a date:

SELECT TO_DATE(
'January 15, 1989, 11:00 A.M.',
'Month dd, YYYY, HH:MI A.M.',
'NLS_DATE_LANGUAGE = American')
FROM DUAL;

TO_DATE('
---------
15-JAN-89
Which types of indexes is created only for columns having PRIMARY KEY or UNIQUE constraint?
Unique
Which statement do you use to assign a privilege to a user or role?
the GRANT statement
A foreign key cannot contain NULL values - True or False ?
1
When a table is created with a statement such as the following: create table newtab as select * from tab; will there be any constraints on the new table?
Check and not null constraints will be copied but not unique or primary key.
What is the advantage of writing a multitable INSERT command that will insert rows from table_a into either tablex, tabley, or tablez based upon some condition, as opposed to executing three separate INSERT statements to insert rows one table at a time?
Performance. The multitable INSERT needs to make only one pass of the data in table_a to get the job done
A composite foreign key cannot have more than 32 columns - Correct or Incorrect about FOREIGN KEY constraint ?
Correct
Which will return the same result as the SQL statement given ? SELECT TO_CHAR (SYSDATE, 'YYYY') FROM DUAL;
SELECT EXTRACT (YEAR FROM SYSDATE) FROM DUAL;
When a commit occurs, what happens to existing savepoints?
All savepoints are erased when a commit occurs
The purpose of the CREATE DIRECTORY statement is to create a named object in the database:
That points to a directory you choose somewhere within the Oracle server’s file system
For existing rows in a table, UPDATE can remove values from any column by changing its value to NULL.
Correct
SELECT * FROM USER_CATALOG; What might be displayed by this statement?
names of all the views that you own
REGEXP_COUNT()
REGEXP_COUNT()

REGEXP_COUNT complements the functionality of the REGEXP_INSTR function by returning the number of times a pattern occurs in a source string. The function evaluates strings using characters as defined by the input character set. It returns an integer indicating the number of occurrences of pattern. If no match is found, then
the function returns 0.

■ source_char is a character expression that serves as the search value. It is commonly a character column and can be of any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.

■ pattern is the regular expression. It is usually a text literal and can be of any of the data types CHAR, VARCHAR2, NCHAR, or NVARCHAR2. It can contain up to 512 bytes. If the data type of pattern is different from the data type of source_
char, then Oracle Database converts pattern to the data type of source_char.

REGEXP_COUNT ignores subexpression parentheses in pattern. For example, the
pattern '(123(45))' is equivalent to '12345'.

■ position is a positive integer indicating the character of source_char where Oracle should begin the search. The default is 1, meaning that Oracle begins the search at the first character of source_char. After finding the first occurrence of
pattern, the database searches for a second occurrence beginning with the first character following the first occurrence.

■ match_param is a text literal that lets you change the default matching behavior of the function. You can specify one or more of the following values for match_param:

- 'i' specifies case-insensitive matching.
- 'c' specifies case-sensitive matching.
- 'n' allows the period (.), which is the match-any-character character, to match the newline character. If you omit this parameter, then the period does not match the newline character.
- 'm' treats the source string as multiple lines. Oracle interprets the caret (^) and dollar sign ($) as the start and end, respectively, of any line anywhere in the source string, rather than only at the start or end of the entire source string.

If you omit this parameter, then Oracle treats the source string as a single line.
- 'x' ignores whitespace characters. By default, whitespace characters match themselves.

If you specify multiple contradictory values, then Oracle uses the last value.

For example, if you specify 'ic', then Oracle uses case-sensitive matching. If you specify a character other than those shown above, then Oracle returns an error.

If you omit match_param, then:
- The default case sensitivity is determined by the value of the NLS_SORT parameter.
- A period (.) does not match the newline character.
- The source string is treated as a single line.

The following example shows that subexpressions parentheses in pattern are ignored:

SELECT REGEXP_COUNT('123123123123123', '(12)3', 1, 'i') REGEXP_COUNT FROM DUAL;

REGEXP_COUNT
------------
5

In the following example, the function begins to evaluate the source string at the third
character, so skips over the first occurrence of pattern:

SELECT REGEXP_COUNT('123123123123', '123', 3, 'i') COUNT FROM DUAL;

COUNT
----------
3
EMP is a private synonym for the OE.EMPLOYEES table.

The user OE issues the following command:

DROP SYNONYM EMP;

Which statement is true regarding the above SQL statement?

A: The synonym would be dropped and the packages referring to the synonym would be dropped.

B: It is not possible to drop the private synonym.

C: Only the synonym would be dropped.

D: The synonym would be dropped and the corresponding table would become invalid
C: Only the synonym would be dropped
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its
database. The database contains a table named Employees. You want to extract those rows where Emp_dept_id is equal to 100. Another objective is to produce a single string literal output from the CONCAT function of the format Emp_f_name Emp_l_name
earns Emp_salary.

Which of the following SQL statements can you use to accomplish the task?

Each correct answer represents a complete solution. Choose two

A: SELECT CONCAT (Emp_f_name,CONCAT(' ', CONCAT(Emp_l_name, CONCAT(' earns
',Emp_salary)))) FROM EMPLOYEES
WHERE Emp_dept_id = 100;

B: SELECT CONCAT ('Emp_f_name',CONCAT(' ', CONCAT('Emp_l_name', CONCAT('
earns ','Emp_salary')))) FROM EMPLOYEES
WHERE Emp_dept_id = 100;

C: SELECT Emp_f_name|| " "||Emp_l_name|| " earns "||Emp_salary FROM EMPLOYEES
WHERE Emp_dept_id = 100;

D: SELECT Emp_f_name|| ' '||Emp_l_name|| ' earns '||Emp_salary FROM EMPLOYEES
WHERE Emp_dept_id = 100;
A: SELECT CONCAT (Emp_f_name,CONCAT(' ', CONCAT(Emp_l_name, CONCAT(' earns
',Emp_salary)))) FROM EMPLOYEES
WHERE Emp_dept_id = 100;

D: SELECT Emp_f_name|| ' '||Emp_l_name|| ' earns '||Emp_salary FROM EMPLOYEES
WHERE Emp_dept_id = 100;
You are asked to update the word "Ave" to "Avenue", "St" to "Street" and "Dr" to "Drive"

Assuming that you have to begin with "Ave", which of the following options should you use to achieve the desired result?

A: UPDATE EMP_ADDRESS SET ADDRESS1 = REGEXP_REPLACE (ADDRESS1,'Ave','Avenue')
WHERE REGEXP_LIKE(ADDRESS1,'Ave*');

B: UPDATE EMP_ADDRESS SET ADDRESS1 = REGEXP_REPLACE ADDRESS1,'Ave*','Avenue')
WHERE REGEXP_LIKE(ADDRESS1,'Ave*');

C: UPDATE EMP_ADDRESS SET ADDRESS1 = REGEXP_REPLACE ADDRESS1,'Ave$','Avenue')
WHERE REGEXP_LIKE(ADDRESS1,'Ave$');

D: UPDATE EMP_ADDRESS SET ADDRESS1 = REGEXP_REPLACE ADDRESS1,'Ave*','Avenue')
WHERE REGEXP_LIKE(ADDRESS1,'Ave$');
C: UPDATE EMP_ADDRESS SET ADDRESS1 = REGEXP_REPLACE (ADDRESS1,'Ave$','Avenue')
WHERE REGEXP_LIKE(ADDRESS1,'Ave$');
Which is a DML statement that is used to update or insert rows conditionally into a table?
MERGE
Evaluate the CREATE TABLE statement:

CREATE TABLE products
(product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY,
product_name VARCHAR2(15));

Which statement is true regarding the PROD_ID_PK constraint?

A. It would be created only if a unique index is manually created first.

B. It would be created and would use an automatically created unique index.

C. It would be created and would use an automatically created nonunique index.

D. It would be created and remains in a disabled state because no index is specified in the
command
B
Which value will the NOT logical condition return when the condition following it is false?
TRUEE
The product table contains these columns:

product_id NUMBER PK
name VARCHAR2(30)
list_price NUMBER(7,2)
cost NUMBER(7,2)

You logged on to the database using SQL*Plus to update the product table. After your session began, you issued these statements:

INSERT INTO product VALUES(4,'Ceiling Fan',59.99,32.45);

INSERT INTO product VALUES(5,'Ceiling Fan',69.99,37.20);

SAVEPOINT A;

UPDATE product SET cost = 0;

SAVEPOINT B;

DELETE FROM product WHERE INITCAP(name) = 'CEILING FAN';

ALTER TABLE product ADD qoh NUMBER DEFAULT 10;

ROLLBACK TO B;

UPDATE product SET name = 'CEILING FAN KIT' WHERE product_id = 4;

Then, you exit the SQL*Plus session.

Assuming that the default behavior of SQL*Plus has not been modified, which of the statements you issued were committed?

only the INSERT statements

only the INSERT statements and the first UPDATE statement

the INSERT statements, the first UPDATE statement, and the DELETE statement

all of the DML operations

none of the DML operations
all of the DML operations
Group functions can operate on multiple rows at a time - Correct or Incorrect ?
Correct
The purpose of the GROUPING function is to:
Differentiate between regular rows and superaggregate rows.
Group Functions can be used on columns or expressions - Correct or Incorrect ?
Correct
It produces 2n possible superaggregates combinations if the n columns and expressions are specified in the GROUP BY clause - Correct or Incorrect regarding CUBE operator ?
Correct
Evaluate the following statement:

INSERT ALL
WHEN order_total < 10000 THEN INTO small_orders
WHEN order_total > 10000 AND order_total < 20000 THEN INTO medium_orders
WHEN order_total > 2000000 THEN INTO large_orders
SELECT order_id, order_total, customer_id FROM orders;

Which statement is true regarding the evaluation of rows returned by the subquery in the INSERT statement?

A. They are evaluated by all the three WHEN clauses regardless of the results of the evaluation of any other WHEN clause.

B. They are evaluated by the first WHEN clause. If the condition is true, then the row would be evaluated by the subsequent WHEN clauses.

C. They are evaluated by the first WHEN clause. If the condition is false, then the row would be evaluated by the subsequent WHEN clauses.

D. The INSERT statement would give an error because the ELSE clause is not present for support
in case none of the WHEN clauses are true.
A
In which situations does a Cartesian product occur?
When data is retrieved from two or more tables and there is no common relation specified in the WHERE clause.
Which columns of the USER_OBJECTS data dictionary view provides you with the last timestamp when TRUNCATE is executed on a table?
LAST_DDL_TIME
The difference between an INNER and an OUTER join is:
The INNER join displays rows that match in all joined tables; the OUTER join shows data that doesn’t necessarily match
Which function returns the number of characters in a column or character string?
LENGTH. The syntax of the LENGTH function is LENGTH(column|expression)
What value is returned after executing the following statement? SELECT NVL2(NULLIF('CODA','SID'),'SPANIEL','TERRIER') FROM DUAL;
SPANIEL
TO_TIMESTAMP()
TO_TIMESTAMP()

TO_TIMESTAMP converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type
to a value of TIMESTAMP data type.

The optional fmt specifies the format of char. If you omit fmt, then char must be in the default format of the TIMESTAMP data type, which is determined by the NLS_TIMESTAMP_FORMAT initialization parameter. The optional 'nlsparam' argument has the same purpose in this function as in the TO_CHAR function for date conversion.

This function does not support CLOB data directly. However, CLOBs can be passed in
as arguments through implicit data conversion.
You created a view that contains groups of data, does NOT allow DML operations, and does NOT contain a subquery. Which type of view did you create?
complex
A user can be granted only one role at any point of time - Correct or Incorrect about ROLES ?
Incorrect
Which privileges allows a user to perform system level activities?
System privilege
If you run DESCRIBE EMP on the SQL prompt, what will the Foreign Key column show up in the NULL? column?
Nothing
In which of the following ways can SQL SELECT retrieve data?
Joining, Projection, Selection
Tasks Performed By - TRIM --
Used to remove heading or trailing or both characters from the character string.
The V$FLASHBACK_DATABASE_LOG view is used to display information about the flashback data. Which of the following columns of this view is used to specify the lowest system change number in the flashback data?
OLDEST_FLASHBACK_SCN
SQL can set permissions on tables, procedures, and views - Correct or Incorrect about SQL ?
Correct
Information about the unused column does not appear in the output of the describe table command - Correct or Incorrect about UNUSED column ?
Correct
Evaluate this statement: DELETE FROM workorder; What does this statement accomplish?
deletes all the rows from the WORKORDER table
Which actions will cause the contents of the data dictionary to be changed in some way?
Create a new table. / Modify the datatype of an existing column. / Execute a valid COMMENT statement
Which set operator returns only the results of the first query that are not in the second query?
MINUS
You want to insert a row and then update it. What sequence of steps should you follow?
INSERT, UPDATE, COMMIT
Which of the following SQL statements will return an ORA error?

Each correct answer represents a complete solution. Choose two.

A: SELECT MOD('13.3',2) FROM DUAL;
B: SELECT MOD('13.3.3',2) FROM DUAL;
C: SELECT MOD('$13.3',2) FROM DUAL;
D: SELECT MOD('13',2) FROM DUAL;
B: SELECT MOD('13.3.3',2) FROM DUAL;

C: SELECT MOD('$13.3',2) FROM DUAL;
The details of the order ID, order date, order total, and customer ID are obtained from the
ORDERS table. If the order value is more than 30000, the details have to be added to the
LARGEjDRDERS table. The order ID, order date, and order total should be added to the
ORDERJHISTORY table, and order ID and customer ID should be added to the CUSTJHISTORY table.

Which multitable INSERT statement would you use?

A. Pivoting INSERT
B. Unconditional INSERT
C. Conditional ALL INSERT
D. Conditional FIRST INSERT
C
Which SQL statement would retrieve from the table the number of products having LIST_PRICE as NULL?

A. SELECT COUNT(list_price)
FROM product_information
WHERE list_price IS NULL;

B. SELECT COUNT(list_price)
FROM product_information
WHERE list_price = NULL;

C. SELECT COUNT(NVL(list_price, 0))
FROM product_information
WHERE list_price IS NULL;

D. SELECT COUNT(DISTINCT list_price) FROM product_information
WHERE list_price IS NULL;
C
You query the database with this SQL statement:

SELECT CONCAT(LOWER(SUBSTR(description, 1, 3)), subject_id) "Subject Description" FROM subject;

In which order are the functions evaluated?

CONCAT, LOWER, SUBSTR
SUBSTR, LOWER, CONCAT
LOWER, SUBSTR, CONCAT
All three will be evaluated simultaneously
SUBSTR, LOWER, CONCAT
It is possible for the WITH clause to hold more than one query - Correct or Incorrect regarding the WITH clause ?
Correct
As the DBA for your organization, you are required to populate the junior_employees and
senior_employees tables with the data from the employees table. The junior_employees table should contain data about the employees who have been working at your company for less than five years. The senior_employees table should contain data about employees who have been working at your company for five or more years. You need to ensure that managers and team leaders are not included in either of these two
tables.

Which of the following INSERT statements should you use to achieve the desired results?

INSERT
WHEN years<5
INTO junior_employees
WHEN years>=5
INTO senior_employees
SELECT * FROM employees
WHERE designation!='Manager' AND designation!='Team Leader';

INSERT
INTO junior_employees
INTO senior_employees
SELECT * FROM employees
WHERE designation!='Manager' AND designation!='Team Leader';

INSERT INTO junior_employees, senior_employees
SELECT * FROM employees
WHERE designation!='Manager' AND designation!='Team Leader';

INSERT
WHEN years<5 AND designation!='Manager' AND designation!='Team Leader'
INTO junior_employees
WHEN years>=5 AND designation!='Manager' AND designation!='Team Leader'
INTO senior_employees;
INSERT
WHEN years<5
INTO junior_employees
WHEN years>=5
INTO senior_employees
SELECT * FROM employees
WHERE designation!='Manager' AND designation!='Team Leader';
SQL GROUP BY is used to divide a database table into groups based on group columns - Correct or Incorrect ?
Correct
To how many levels can group functions be nested?
two
The child rows of a parent row are determined by a given condition - Correct or Incorrect about Hierarchial Queries ?
Correct
Evaluate this SQL statement:

SELECT supplier_id, AVG(cost)
FROM product
WHERE AVG(list_price) > 60.00
GROUP BY supplier_id
ORDER BY AVG(cost) DESC;

Which clause will cause an error?

SELECT

WHERE

GROUP BY

ORDER BY
WHERE
Can a multitable INSERT insert rows into multiple tables and views in a single pass?
No. A multitable INSERT cannot insert rows into views
Outer join conditions CANNOT be linked to another condition by which operator?
the OR operator
You want to display data from the EMP table where the result set needs to be sorted by
DEPTNO first in ascending order and then by SAL in descending order.

Which of the following queries will produce the required result set?

Each correct answer represents a complete solution. Choose all that apply

A: SELECT * FROM EMP ORDER BY DEPTNO, SAL DESC;

B: SELECT * FROM EMP ORDER BY DEPTNO, SAL;

C: SELECT * FROM EMP ORDER BY DEPTNO DESC, SAL;

D: SELECT * FROM EMP ORDER BY DEPTNO ASC, SAL DESC;
A: SELECT * FROM EMP ORDER BY DEPTNO, SAL DESC;

D: SELECT * FROM EMP ORDER BY DEPTNO ASC, SAL DESC;
Which database objects is a subset of data from one or more tables and stored in the database as a query?
Views
A table alias:
Exists only for the SQL statement that declared it. / Can be used to clear up ambiguity in the query.
Which two constructs can be used to emulate an IF-THEN-ELSE condition within a SELECT statement?
the DECODE function and the CASE expression
Which clause of the SELECT statement is used to exclude entire branches from the output of a hierarchical query?
CONNECT BY
If SYSDATE returns 12-JUL-2009, what is returned by the following statement? SELECT TO_CHAR(TO_DATE(TO_CHAR(SYSDATE,'DD'),'DD'),'YEAR') FROM DUAL;
TWO THOUSAND NINE
create sequence seq1 start with 1; After selecting from it a few times, you want to reinitialize it to reissue the numbers already generated. How can you do this?
You must drop and re-create the sequence
How do you grant UPDATE privileges on specific columns in a table?
Include a column list in the GRANT statement. This syntax is only valid with the UPDATE, REFERENCES, and INSERT privileges.
Which object privileges CANNOT be granted to roles?
REFERENCES
ADD_MONTHS()
ADD_MONTHS returns the date date plus integer months. A month is defined by the
session parameter NLS_CALENDAR.
The date argument can be a datetime value or any value that can be implicitly converted to DATE.
The integer argument can be an integer or any value that can be implicitly converted to an integer.
The return type is always DATE, regardless of the data type of date. If date is the last day of the month or if the resulting month has fewer days than the day component of date, then the result is the last day of the resulting month. Otherwise, the result has the same day component as date.
When using the FLASHBACK VERSION QUERY to track changes in table data, which of the following columns will give you the transaction number of the transaction that executed and changed data in that table?
versions_xid
SQL can create stored procedures in a database - Correct or Incorrect about SQL ?
Correct
Tasks Performed By - TRUNC --
Used to truncate a column, expression, or value to n decimal places.
Constraints can be created at the same time as the table or after the table is created - Correct or Incorrect about Constraints ?
Correct
Which commands can clear the formatting done for columns of a table?
CLEAR COLUMNS
A CONSTRAINT is assigned to which of the following?
TABLE
Consider this statement: insert into regions (region_id,region_name) values ((select max(region_id)+1 from regions), 'Great Britain'); What will the result be?
The statement will execute without error.
Which data dictionary view could you query to display the names of tables you have access to?
ALL_OBJECTS
Which types of operators - Character, Set, Arithmatic, Comparison - is used for the concatenation (||) operator?
Character
If within a transaction, a single DML statement fails, what is rolled back?
only the work of the offending DML statement
Which access drivers is used to unload data from a table in the database and insert it into an external table?
ORACLE_DATAPUMP
View the Exhibit and examine the structure of the ORDERS and ORDER_ITEMS tables.

In the ORDERS table, ORDER_ID is the PRIMARY KEY and ORDER_DATE has the DEFAULT value as SYSDATE.

Evaluate the following statement:

UPDATE orders
SET order_date=DEFAULT
WHERE order_id IN (SELECT order_id FROM order_items WHERE qty IS NULL);

What would be the outcome of the above statement?

A. The UPDATE statement would not work because the main query and the subquery use
different tables.
B. The UPDATE statement would not work because the DEFAULT value can be used only in
INSERT statements.
C. The UPDATE statement would change all ORDER_DATE values to SYSDATE provided the
current ORDER_DATE is NOT NULL and QTY is NULL
D. The UPDATE statement would change all the ORDER_DATE values to SYSDATE irrespective
of what the current ORDER_DATE value is for all orders where QTY is NULL
D
Evaluate the following statements:

CREATE TABLE digits
(id NUMBER(2),
descriptionVARCHAR2(15));

INSERT INTO digits VALUES (1,'ONE);

UPDATE digits SET description ='TWO'WHERE id=1;

INSERT INTO digits VALUES (2 .'TWO');

COMMIT;

DELETE FROM digits;

SELECT description FROM digits
VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE;

What would be the outcome of the above query?

A. It would not display any values.
B. It would display the value TWO once.
C. It would display the value TWO twice.
D. It would display the values ONE, TWO, and TWO.
C
You work as a Database Administrator for TechSoft Inc. You want to create a simple
database view on which other privileged users should not be able to perform DML operations.

Which of the following options will you choose?

Each correct answer represents a complete solution. Choose all that apply.

A: Create the view with the WITH CHECK OPTION option.

B: Create the view as a Complex View.

C: Grant only SELECT access on the view to users.

D: Create the view with the OR REPLACE option.

E: Create the view with the WITH READ ONLY option
B: Create the view as a Complex View.
C: Grant only SELECT access on the view to users.
E: Create the view with the WITH READ ONLY option
You work as a Database Developer for Dolliver Inc. The company uses Oracle as its database. The database contains tables named Product and Sales. You have created a CHECK constraint on the Product table by using the following syntax:

CREATE TABLE product
(p_id NUMBER(4),
p_name VARCHAR2(20),
CONSTRAINT check_p_id
CHECK(p_id BETWEEN 1 and 100));

In the given scenario, which of the following statements about the CHECK constraint
are true?

Each correct answer represents a complete solution. Choose all that apply.

A: The check_p_id cannot be defined on a view.

B: The check_p_id cannot refer to columns of the Sales table.

C: The check_p_id can be defined at the row level of the Product table.

D: The check_p_id cannot include a subquery.
A: The check_p_id cannot be defined on a view.

B: The check_p_id cannot refer to columns of the Sales table

D: The check_p_id cannot include a subquery.
The GROUP BY clause is mandatory if you are using an aggregate function in the SELECT clause - Correct or Incorrect ?
Incorrect
Group Functions can be used along with the single-row function in the SELECT clause of a SQL statement - Correct or Incorrect ?
Correct
John works as a DBA for the railways. Data for all trains and passengers is centrally managed in the
railway_records database. This database has train_info and passenger_info tables that contain data about various local trains and passengers for all the stations. The RailwayRecords database is unavailable for a few days after a server crash. Officers at the local stations store data in a Notepad file when the database in unavailable. When the server is functional again, John needs to collate the data from all the Notepad files and
populate the railway_records database.

He executes the following statements:

USE DATABASE railway_records;
CREATE TABLE missing_railway_info
(
train_no NUMBER(10),
origin_point VARCHAR2,
destination_point VARCHAR2
)
ORGANIZATION EXTERNAL
(
TYPE ORACLE_LOADER
ACCESS PARAMETER
(
RECORDS DELIMITED BY NEWLINE
LOGFILE 'train.log'
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
( train_no,
origin_point,
destination_point )
)
LOCATION ('station1.txt', 'station2.txt', 'station3.txt')
PARALLEL 3;

Which of the following are TRUE about the given statements? (Choose all that apply.)

Data can be loaded from the external table into the railway_records database.

Data in the missing_railway_info table can be retrieved in parallel.

Data is loaded from the station1.txt file only.

Data is loaded from the station1.txt and the station2.txt files only.
Data can be loaded from the external table into the railway_records database.

Data in the missing_railway_info table can be retrieved in parallel.
A CHECK constraint can only contain reference of the table in which it is created and not of columns belonging to other tables - Correct or Incorrect ?
Correct
Which type of outer join includes all matched rows and all unmatched rows in the second table listed?
a right outer join
You work as a Database Developer for Gadgets Inc. The company uses Oracle as its database.

You create a view for a table named Employee using the following syntax:

CREATE VIEW emp1
AS SELECT employee_id, last name, salary
FROM employee
WHERE dept_id = 60;

Which of the following statements about a view are true?

Each correct answer represents a complete solution. Choose two

A: It is a virtual table.

B: It provides a brief description of a database.

C: It helps to manage permissions and other administrative tasks on a table.

D: It is used to speed up the data retrieval process.
A: It is a virtual table.

C: It helps to manage permissions and other administrative tasks on a table
It is used to test whether the values retrieved by the outer query exist in the result of the inner query - Correct or Incorrect regarding EXIST operator used in Correlated subquery ?
Correct
It is totally and automatically maintained by Oracle - Correct or Incorrect about Oracle Data Dictionary ?
Correct
If a column is used frequently in the search criteria of a WHERE clause, what additional attribute would that column need to have in order to consider building an index on it?

a column that is a small number of characters or digits

a column that is updated frequently

a column containing a wide range of values

a column with a small number of null values
a column containing a wide range of values
What is produced when a join condition is not specified in a multiple-table query?
a Cartesian product or cross join
Which of the following join conditions is generally associated with a hierarchical query?
Self-join
To insert data through a simple view, must you include all NOT_NULL columns that do not have a default value assigned in the view definition?
Yes
If SYSDATE returns 12-JUL-2009, what is returned by the following statement? SELECT TO_CHAR(SYSDATE, 'fmDDth MONTH') FROM DUAL;
12TH JULY
Which element would be used in a format model to return the spelled-out year?
YEAR or SYEAR
Where does Oracle store the granted privileges?
Data dictionary
revoke privileges on object from user; - Correct or Incorrect for revoking privileges on a table?
Correct
REFERENCES is a system privilege - Correct or Incorrect about System Privilege ?
Incorrect
One sequence can be used for multiple tables in the same schema - Correct or Incorrect about a Sequence ?
Correct
Tasks Performed By -- INSTR --
Used to return the numeric value for position of a named character from the character string.
You need to add a NOT NULL constraint to the QUANTITY column in the PO_DETAIL table. Which statement should you use to complete this task?
ALTER TABLE po_detail MODIFY (quantity NOT NULL);
Constraints can be created before a table is created - True or False ?
1
Which statement type would be used to remove transactions more than one year old from the TRX table?
DML
A subquery can be placed in a WHERE clause, GROUP BY clause, or a HAVING clause - True or False regarding Subqueries ?
1
Which represents the correct pair-wise comparison in which the rows in the subquery are evaluated in the main query of the multiple-column subquery?
Column-to-column comparison and row-to-row comparison
Which data dictionary view displays only the data dictionary views accessible to the user?
DICTIONARY
If a compound query contains both a MINUS and an INTERSECT operator, which will be applied first?
The precedence is determined by the order in which they are specified
If you issue this command: update employees set salary=salary * 1.1; what will be the result?
Every row will have SALARY incremented by 10 percent, unless SALARY was NULL
Which indexes store rowids associated with a key value as a bitmap?
Bitmap indexes
More than one base table can be updated through a view - Correct or Incorrect about UPDATE statements ?
Incorrect
In which of the following situations will you use the ROLLUP feature for expressions or columns within a GROUP BY clause?

Each correct answer represents a complete solution. Choose all that apply.

A: To find the groups forming the sub totals in a row.

B: To speed up and simplify the maintenance and population of summary tables.

C: For subtotaling along a hierarchical dimension such as geography or time.

D: To create grouping of expressions or columns specified within a GROUP BY clause in one direction from left to right for calculating the sub totals.
B: To speed up and simplify the maintenance and population of summary tables.

C: For subtotaling along a hierarchical dimension such as geography or time.

D: To create grouping of expressions or columns specified within a GROUP BY clause in one direction from left to right for calculating the sub totals.
Which of the following should be put together (separated by commas) to define
concatenated groupings?

Each correct answer represents a complete solution. Choose all that apply.

A: AVG
B: ROLLUPs
C: GROUPING SETS
D: CUBEs
B: ROLLUPs
C: GROUPING SETS
D: CUBEs
Samantha works as a Database Administrator for Dolliver Inc. The company uses an Oracle database. David is an employee in the company. He has created a few database objects in his schema. Now, Samantha wants to restrict David from accessing the database. She also wants to ensure that the objects owned by David remain intact in the database.

What will she do to accomplish this?

Each correct answer represents a complete solution. Choose two.

A: Lock David's user account.

B: Revoke the RESTRICTED SESSION privilege from David's user account.

C: Drop David's user account from the database.

D: Revoke the CREATE SESSION privilege from David's user account
A: Lock David's user account.

D: Revoke the CREATE SESSION privilege from David's user account
The following are the steps for a correlated subquery, listed in random order:

1. The WHERE clause of the outer query is evaluated.
2. The candidate row is fetched from the table specified in the outer query.
3. The procedure is repeated for the subsequent rows of the table, till all the rows are processed.
4. Rows are returned by the inner query, after being evaluated with the value from the candidate row in the outer query.

Identify the option that contains the steps in the correct sequence in which the Oracle server evaluates a correlated subquery.

A: 4-1-2-3
B: 2-4-1-3
C: 4-2-1-3
D: 2-1-4-3
B: 2-4-1-3
Which is the default value of ORDER BY clause to sort the result set?
ASC
Evaluate the SQL statements:

CREATE TABLE new_order
(orderno NUMBER(4),
booking_dateTIMESTAMP WITH LOCAL TIME ZONE);

The database is located in San Francisco where the time zone is -8:00.

The user is located in New York where the time zone is -5:00.

A New York user inserts the following record:

INSERT INTO new_order
VALUES(1, TIMESTAMP ?007-05-10 6:00:00 -5:00?);

Which statement is true?

A. When the New York user selects the row, booking_date is displayed as 007-05-10
3.00.00.000000'

B. When the New York user selects the row, booking_date is displayed as 2007-05-10
6.00.00.000000 -5:00'.

C. When the San Francisco user selects the row, booking_date is displayed as 007-05-10 3.00.00.000000'

D. When theSan Francisco user selects the row, booking_date is displayed as 007-05-10 3.00.00.000000 -8:00'
C
Which regular expression functions search a given pattern in the source string and returns the row(s) that satisf(ies)y the specified condition?
REGEXP_LIKE / REGEXP_SUBSTR
You have been assigned a task to transform a non-relational database into relational
database tables. This is required, as the source data is not in relational format.

Which of the following options should you use to accomplish the given task?

A: Conditional INSERT FIRST
B: Conditional INSERT ALL
C: Unconditional INSERT ALL
D: Pivoting INSERT
D: Pivoting INSERT
A Correlated sub-query is evaluated once for every row returned by the outer query - Correct or Incorrect regarding Correlated subquery ?
Correct
Which data dictionary views contains comments on columns of all tables and views?
DBA_COL_COMMENTS
You work as a Database Developer for Dolliver Inc. The company uses Oracle 11g as its
database. The company implements its incentive policy for only those employees who have completed six months of work or are contributing exceptionally well to the company. The company's database contains a table named Employee. You want to retrieve the records of all those employees who are not eligible for the incentive policy.

Which of the following SQL commands can you use to accomplish the task?

Each correct answer represents a complete solution. Choose two.

A: SELECT * FROM EMPLOYEE WHERE Emp_incentive ISNULL;

B: SELECT * FROM EMPLOYEE WHERE Emp_incentive IS NULL;

C: SELECT * FROM EMPLOYEE WHERE NOT(Emp_incentive IS NOT NULL);

D: SELECT * FROM EMPLOYEE WHERE Emp_incentive = NULL;
B: SELECT * FROM EMPLOYEE WHERE Emp_incentive IS NULL;

C: SELECT * FROM EMPLOYEE WHERE NOT(Emp_incentive IS NOT NULL);
GROUP BY cannot be used without the ORDER BY clause - Correct or Incorrect ?
Incorrect
Which is a join of a table to itself?
Self join
An error occurs when a row is both the parent and the child - Correct or Incorrect about Hierarchial Queries ?
Correct
Which statement can be used to alter a view?
CREATE OR REPLACE VIEW
What value is returned after executing the following statement? SELECT NVL(SUBSTR('AM I NULL',10),'YES I AM') FROM DUAL;
YES I AM
If today is March 12, 2012, under what conditions will the statement SELECT to_date('12-Mar-2012') sysdate FROM dual; produce the number 0 for its output?
When it was executed at exactly midnight.
Which function can be used to determine the number of months between two dates?
MONTHS_BETWEEN. The syntax of the MONTHS_BETWEEN function is MONTHS_BETWEEN(date1, date2)
They can contain group functions - True Or False regarding Multiple-Row subquery ?
1
GRANT CREATE TABLE TO user1, user2 - Correct or Incorrect ?
Correct
REGEXP_INSTR()
REGEXP_INSTR()

REGEXP_INSTR extends the functionality of the INSTR function by letting you search a string for a regular expression pattern. The function evaluates strings using characters as defined by the input character set. It returns an integer indicating the
beginning or ending position of the matched substring, depending on the value of the return_option argument. If no match is found, then the function returns 0.

■ source_char is a character expression that serves as the search value. It is commonly a character column and can be of any of the data types CHAR,VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.

■ pattern is the regular expression. It is usually a text literal and can be of any of the data types CHAR, VARCHAR2, NCHAR, or NVARCHAR2. It can contain up to 512 bytes. If the data type of pattern is different from the data type of source_
char, then Oracle Database converts pattern to the data type of source_char.

■ position is a positive integer indicating the character of source_char where Oracle should begin the search. The default is 1, meaning that Oracle begins the search at the first character of source_char.

■ occurrence is a positive integer indicating which occurrence of pattern in source_char Oracle should search for. The default is 1, meaning that Oracle searches for the first occurrence of pattern. If occurrence is greater than 1,
then the database searches for the second occurrence beginning with the first
character following the first occurrence of pattern, and so forth. This behavior is different from the INSTR function, which begins its search for the second occurrence at the second character of the first occurrence.

■ return_option lets you specify what Oracle should return in relation to the occurrence:
- If you specify 0, then Oracle returns the position of the first character of the occurrence. This is the default.
- If you specify 1, then Oracle returns the position of the character following the occurrence.

■ match_parameter is a text literal that lets you change the default matching behavior of the function. The behavior of this parameter is the same for this function as for REGEXP_COUNT. Refer to REGEXP_COUNT on page 5-158 for
detailed information.

■ For a pattern with subexpressions, subexpr is an integer from 0 to 9 indicating which subexpression in pattern is the target of the function. The subexpr is a fragment of pattern enclosed in parentheses. Subexpressions can be nested.

Subexpressions are numbered in order in which their left parentheses appear in pattern.

For example, consider the following expression:
0123(((abc)(de)f)ghi)45(678)

This expression has five subexpressions in the following order: "abcdefghi" followed by "abcdef", "abc", "de" and "678".

If subexpr is zero, then the position of the entire substring that matches the pattern is returned. If subexpr is greater than zero, then the position of the substring fragment that corresponds to subexpression number subexpr in the
matched substring is returned. If pattern does not have at least subexpr subexpressions, the function returns zero. A null subexpr value returns NULL.
The default value for subexpr is zero.

The following example examines the string, looking for occurrences of one or more non-blank characters. Oracle begins searching at the first character in the string and returns the starting position (default) of the sixth occurrence of one or more non-blank characters.

SELECT REGEXP_INSTR('500 Oracle Parkway, Redwood Shores, CA', '[^ ]+', 1, 6) "REGEXP_INSTR" FROM DUAL;

REGEXP_INSTR
------------
37

The following example examines the string, looking for occurrences of words beginning with s, r, or p, regardless of case, followed by any six alphabetic characters. Oracle begins searching at the third character in the string and returns the position in
the string of the character following the second occurrence of a seven-letter word beginning with s, r, or p, regardless of case.

SELECT REGEXP_INSTR('500 Oracle Parkway, Redwood Shores, CA', '[s|r|p][[:alpha:]]{6}', 3, 2, 1, 'i') "REGEXP_INSTR" FROM DUAL;

REGEXP_INSTR
------------
28
Using the FLASHBACK feature of Oracle, which of the following options will retrieve data from the EMP table for a particular time without actually doing a restore of the EMP table?
SELECT * FROM EMP AS OF TIMESTAMP <timestamp>; / DBMS_FLASHBACK.ENABLE_AT_TIME (<timestamp>); SELECT * FROM EMP;
A constraint name must be provided when using the WITH CHECK OPTION clause or the statement will fail - Correct or Incorrect concerning the creation of a view ?
Incorrect
Roles are owned by the SYS user - Correct or Incorrect about ROLES ?
Incorrect
Which are the types of SQL statement?
DDL, DML, DCL
Which object methods provide access to the data of an object?
Member Methods
The WITH clause may be processed as an inline view or resolved as a temporary table - Correct or Incorrect ?
Correct
Which of the following SQL keyword is used to sort the result set of a query?
ORDER BY
Single Row Functions can accept only one argument - True or False ?
1
Which of the following utilities offers statement tracing and instant feedback on any successful SELECT, INSERT, UPDATE or DELETE statement?
Autotrace
An external table named ContractEmployees provides data for the Employees table in a database. DROP TABLE ContractEmployees; Which statements is TRUE about the DROP TABLE statement?
The DROP TABLE statement removes only the metadata of the external table from the database
You have been assigned a task to transform a non-relational database into relational database tables. This is required, as the source data is not in relational format. Which options should you use to accomplish the given task?
Pivoting INSERT
They impose rules to be followed when data/rows are being added, modified and removed from a table - Correct or Incorrect about CONSTRAINTS ?
Correct
Which of the following will be the result of executing the following SQL statement?

SELECT TRUNC(SYSDATE,'YEAR') FROM DUAL;

Assume that the value of SYSDATE is equal to 30-DEC-2008.

A: 30-DEC-2007
B: 01-JAN-2007
C: 31-DEC-2008
D: 01-JAN-2008
D: 01-JAN-2008
You have written the following CREATE SEQUENCE statement:

CREATE SEQUENCE s1
START WITH 100
INCREMENT BY 10
MAXVALUE 500
CYCLE
NOCACHE;

The sequence s1 has generated numbers up to the maximum limit of 500. You issue the following SQL statement:

SELECT s1.nextval FROM dual;

Which of the following is the correct output displayed by the SELECT statement?

A: 10
B: 1
C: 100
D: 500
B: 1
The details of the order ID, order date, order total, and customer ID are obtained from the
ORDERS table. If the order value is more than 30000, the details have to be added to the
LARGE_DRDERS table. The order ID, order date, and order total should be added to the
ORDER_HISTORY table, and order ID and customer ID should be added to the CUST_HISTORY table.

Which multitable INSERT statement would you use?

A. Pivoting INSERT
B. Unconditional INSERT
C. Conditional ALL INSERT
D. Conditional FIRST INSERT
C
Which of the following commands will specify a DEFAULT value for the HIREDATE column in the EMP table?

Each correct answer represents a complete solution. Choose all that apply.

A: CREATE TABLE EMP
(
EMPNO NUMBER(5),
HIREDATE DATE,
DEFAULT HIREDATE SYSDATE
);

B: CREATE TABLE EMP
(
EMPNO NUMBER(5),
HIREDATE DATE DEFAULT SYSDATE
);

C: ALTER TABLE EMP MODIFY HIREDATE DEFAULT SYSDATE;

D: ALTER TABLE EMP MODIFY HIREDATE DEFAULT=SYSDATE;
B: CREATE TABLE EMP
(
EMPNO NUMBER(5),
HIREDATE DATE DEFAULT SYSDATE
);

C: ALTER TABLE EMP MODIFY HIREDATE DEFAULT SYSDATE
SELECT REGEXP_REPLACE('Charles Dickens','([[:alpha:]]+) ([[:alpha:]]+)','2') FROM DUAL; What will this SQL statement return when executed?
Dickens
View the Exhibit and examine PRODUCTS and ORDER_ITEMS tables.

You executed the following query to display PRODUCT_NAME and the number of times the
product has been ordered:

SELECT p.product_name, i.item_cnt
FROM (SELECT product_id, COUNT (*) item_cnt
FROM order_items GROUP BY product_id) i RIGHT OUTER JOIN products p
ON i.product_id = p.product_id;

What would happen when the above statement is executed?

A. The statement would not execute because the WHERE clause is not allowed with LEFT
OUTER JOIN.

B. The statement would execute successfully to produce the required output.

C. The statement would not execute because inline views and outer joins cannot be used
together.

D. The statement would not execute because the ITEM_CNT alias cannot be displayed in the
outer query.

E. The statement would not execute because the GROUP BY clause cannot be used in the inline
view.
A
Which SQL operations support the usage of sub-queries for viewing and manipulating table data?
SELECT, INSERT, UPDATE, CREATE TABLE
EMP is a table with all the details of employees and EMP_TERM is a new table with
employee number and name of the employees that have been terminated from the company.

Which of the following options are the alternative ways to write the following SQL query?

SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE, A.SAL, A.MGR, A.DEPTNO
FROM EMP A WHERE (A.EMPNO, A.ENAME) IN (SELECT B.EMPNO, B.ENAME FROM
EMP_TERM B);

Each correct answer represents a complete solution. Choose two.

A: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE, A.SAL, A.MGR, A.DEPTNO
FROM EMP A WHERE A.EMPNO IN (SELECT
B.EMPNO FROM EMP_TERM B) AND A.ENAME IN (SELECT C.ENAME FROM EMP_TERM C);

B: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE, A.SAL, A.MGR, A.DEPTNO
FROM EMP A WHERE (A.ENAME, A.EMPNO) IN (SELECT B.EMPNO, B.ENAME FROM EMP_TERM B);

C: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE, A.SAL, A.MGR, A.DEPTNO
FROM EMP A WHERE A.EMPNO = (SELECT B.EMPNO FROM EMP_TERM B)
AND A.ENAME = (SELECT C.ENAME FROM EMP_TERM C);

D: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE, A.SAL, A.MGR, A.DEPTNO
FROM EMP A WHERE (A.EMPNO, A.ENAME) IN (SELECT * FROM EMP_TERM B);
A: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE,
A.SAL, A.MGR, A.DEPTNO FROM EMP A
WHERE A.EMPNO IN (SELECT B.EMPNO FROM EMP_TERM B) AND A.ENAME IN (SELECT C.ENAME FROM EMP_TERM C);

D: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE,
A.SAL, A.MGR, A.DEPTNO FROM EMP A
WHERE (A.EMPNO, A.ENAME) IN (SELECT * FROM EMP_TERM B);
Group Functions are also known as aggregate functions - Correct or Incorrect ?
Correct
Which of the following statements is true of Boolean operators?
OR is evaluated after AND / NOT is evaluated first
Which of the following precedence orders represents the correct precedence of the
operators?

A: + (binary), - (unary), *, /, +, -, ||, =, !=, <, >, <=, >=, IS NULL, LIKE, IN,BETWEEN, NOT, AND, OR

B: +, -, *, /, +, -, ||, =, !=, <, >, <=, >=, LIKE, IS NULL BETWEEN, IN, NOT, AND,OR

C: + (unary), - (binary), +, -, *, /, ||, =, !=, <, >, <=, >=, IS NULL, LIKE, BETWEEN,IN, NOT, OR, AND

D: + (unary), - (unary), *, /,+, -, ||, =, !=, <, >, <=, >=, IS NULL, LIKE, BETWEEN,IN, NOT, AND, OR
D: + (unary), - (unary), *, /,+, -, ||, =, !=, <, >, <=, >=, IS NULL, LIKE, BETWEEN,IN, NOT, AND, OR
The relationship between the parent rows and their child rows is established automatically - Correct or Incorrect about Hierarchial Queries ?
Incorrect
How do you create an inline view?
include a subquery as a data source in a FROM clause
SELECT TO_DATE('02-AUG-2007') - TO_DATE('25-JUL-2007') FROM DUAL; Which statements about the above mentioned SQL query is true?
Oracle will display 8 as the output.
The GROUPING SETS operation combines the equivalent of several GROUP BY clauses with the functionality of which of the following?
UNION ALL
When using the TO_CHAR function to format dates, which format model element will display the numeric day number of the month?
DD or dd
The USER_CONS_COLUMNS view should be queried to find the names of the columns to which a constraint applies - True or False regarding Data Dictionary Views ?
TRUE
What value is returned after executing the following statement? SELECT REPLACE('How_long_is_a_piece_of_string?','_','') FROM DUAL;
Howlongisapieceofstring?
They are not based/dependent on a particular database object - Correct or Incorrect about System Privileges ?
Correct
create sequence seq1 maxvalue 50; If the current value is already 50, when you attempt to select SEQ1.NEXTVAL what will happen?
There will be an error
Which object level privileges can you grant on a database table?
INSERT / REFERENCES / ALTER / INDEX
SELECT sequence_name, min_value, max_value, increment_by, last_number FROM user_sequences; Which of the following statements represents the significance of the last_number column?
The last_number column displays the next available sequence number if NOCACHE is specified.
A table is which of the following?
A schema object
What is the difference between a nested and a correlated subquery?
A nested subquery executes the inner query first
The minimum column width that can be specified for a Varchar2 data type column is one - True or False about Oracle Data Types ?
1
What must you do to create a column alias containing spaces?
Enclose the column alias in double quotes (")
CREATE TABLE LETTERS (LETTER_ID NUMBER(7), POSTAGE NUMBER(7)); Which of the following will change POSTAGE to be an UNUSED column?
ALTER TABLE LETTERS SET UNUSED COLUMN POSTAGE;
If a view was created with the WITH CHECK OPTION, then the view can be updated only if the resulting data satisfies the view's defining query - Correct or Incorrect about UPDATE statement ?
Correct
They prevent invalid data to be entered into tables - Correct or Incorrect about CONSTRAINTS ?
Correct
The CREATE, ALTER, DROP, RENAME, and TRUNCATE statements are examples of which category of SQL statement?
DDL
You work as a Database Technical support for Dolliver Inc. The company uses Oracle 11g as its database. The database has a table named Employee. One of your clients wants to know which function he should use to show the average age of employees as 42.4 instead of 42.39 in the Age column of the table. Which of the following functions will you suggest him to use?

A: TRUNC(42.39,1)
B: CEIL(42.39)
C: ROUND(42.39,1)
D: MOD(42.39,1)
C: ROUND(42.39,1)
You work as a Database Administrator for Education Inc. You have installed the
enterprise edition of Oracle 11g to check the functionality of regular expressions. You
create a table named Student that holds information of all students. You want to retrieve rows of those students whose enrollment number does not include a digit. For this purpose, you used the caret (^) metacharacter.

Which of the following is the correct usage of a metacharacter?

A: ^[[:digit]]
B: [[:digit:]^]
C: [[:digit:^]]
D: [^[:digit:]]
D: [^[:digit:]]
Which of the following queries is qualified as a correlated sub-query?

A: SELECT X.DEPTNO, X.ENAME, X.SAL
FROM EMP X
WHERE X.SAL > (SELECT AVG(Y.SAL)
FROM EMP Y
WHERE X.DEPTNO = Y.DEPTNO)
ORDER BY X.DEPTNO;

B: SELECT X.DEPTNO, X.ENAME, X.SAL
FROM EMP X
WHERE X.SAL > (SELECT AVG(Y.SAL)
FROM EMP Y)
ORDER BY X.DEPTNO;

C: SELECT X.DEPTNO, X.ENAME, X.SAL
FROM EMP X
WHERE X.SAL > (SELECT AVG(Y.SAL)
FROM EMP Y
WHERE Y.DEPTNO = 10)
ORDER BY X.DEPTNO;

D: SELECT X.DEPTNO, X.ENAME, X.SAL
FROM EMP X
WHERE X.SAL > (SELECT AVG(Y.SAL)
FROM EMP Y)
ORDER BY Y.DEPTNO;
A: SELECT X.DEPTNO, X.ENAME, X.SAL
FROM EMP X
WHERE X.SAL > (SELECT AVG(Y.SAL)
FROM EMP Y
WHERE X.DEPTNO = Y.DEPTNO)
ORDER BY X.DEPTNO;
ABS()
ABS returns the absolute value of n.
This function takes as an argument any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. The function returns the same data type as the numeric data type of the argument.

The following example returns the absolute value of -15:

SELECT ABS(-15) "Absolute"
FROM DUAL;
Absolute
----------
15
A Correlated sub-query cannot return multiple columns - Correct or Incorrect regarding Correlated Subquery ?
Incorrect
You work as a Database Administrator for Gentech Inc. The company uses an Oracle
database. Andrew joins the company as an Assistant Database Administrator. You are required to grant him the privilege that allows him to create a database.

Which of the following privileges will you grant him?

A: DBA
B: SYSDBA
C: SYSOPER
D: DEFAULT
B: SYSDBA
Group Function can be used only with the SQL statement that has the GROUP BY clause - Correct or Incorrect ?
Incorrect
Which is NOT a way to sequence Oracle output rows?
Oracle external sort
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its
database. The database contains a table named Employees. You want to retrieve Emp_id, Emp_name, and Emp_join_date of all those employees who have worked for more than 24 months since their joining date till 01-JAN-2008.

Which of the following SQL queries will you use to accomplish the task?

A: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE MONTHS_BETWEEN (Emp_join_date, '01-JAN-2008') >24;

B: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE Emp_join_date BETWEEN Emp_join_date AND '01-JAN-
2008';

C: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE MONTHS_BETWEEN ('01-JAN-2008', Emp_join_date) >24;

D: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE Emp_join_date IN (Emp_join_date, '01-JAN-2008');
C: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE MONTHS_BETWEEN ('01-JAN-2008', Emp_join_date) >24;
Rows in the target table can be deleted using the MERGE statement - Correct or Incorrect ?
Correct
Evaluate the CREATE TABLE statement:

CREATE TABLE employee
(emp_id Number (6) CONSTRAINT emp_id_pk PRIMARY KEY,
emp_name VARCHAR2(15));

Which of the following statements is true regarding the emp_id_pk constraint?

A: It would not be created and will display an error message.

B: It would be created and remain in the disabled state because no index is specified in the command.

C: It would be created only if a unique index is manually created first.

D: It would be created and would use an automatically created unique index
D: It would be created and would use an automatically created unique index.
Which pseudocolumn can be used with a sequence to display the current value of that sequence?
CURRVAL
Which of the following SQL datatypes cannot store fractional seconds?
DATE
It is used to display group data for all possible combinations of expressions - Correct or Incorrect about CUBE operator ?
Correct
Which date function returns the ending date of the month containing a given date?
LAST_DAY. The syntax of the LAST_DAY function is LAST_DAY(date)
Which clause in a SQL expression will enable a single statement to calculate all possible combinations of aggregations?
GROUP BY CUBE
A subquery can be used in a CREATE VIEW statement, regardless of the number of rows it returns - True or False regarding Subquery ?
1
Built-In SQl Functions Are available for use within a SELECT statement’s WHERE clause, as well as the SELECT statement’s expression list - True or False ?
1
An index that is based on more than one column is:
A composite index
Built-In SQl Functions Are available for use from the UPDATE statement - True or False ?
1
It contains the object privileges granted to other users by the current user session - Correct or Incorrect about the SESSION_PRIVS dictionary view ?
Incorrect
Which index is built on columns with low cardinality and is used for data warehouse applications?
Bitmap index
REGEXP_REPLACE()
REGEXP_REPLACE()

REGEXP_REPLACE extends the functionality of the REPLACE function by letting you search a string for a regular expression pattern. By default, the function returns source_char with every occurrence of the regular expression pattern replaced with replace_string. The string returned is in the same character set as source_char.
The function returns VARCHAR2 if the first argument is not a LOB and returns CLOB if
the first argument is a LOB.

■ source_char is a character expression that serves as the search value. It is commonly a character column and can be of any of the data types CHAR,VARCHAR2, NCHAR, NVARCHAR2, CLOB or NCLOB.

■ pattern is the regular expression. It is usually a text literal and can be of any of the data types CHAR, VARCHAR2, NCHAR, or NVARCHAR2. It can contain up to 512 bytes. If the data type of pattern is different from the data type of source_
char, then Oracle Database converts pattern to the data type of source_char.

■ replace_string can be of any of the data types CHAR, VARCHAR2, NCHAR,NVARCHAR2, CLOB, or NCLOB. If replace_string is a CLOB or NCLOB, then Oracle truncates replace_string to 32K. The replace_string can contain up to 500 backreferences to subexpressions in the form \n, where n is a number from 1 to 9. If n is the backslash character in replace_string, then you must precede it with the escape character (\\).

■ position is a positive integer indicating the character of source_char where Oracle should begin the search. The default is 1, meaning that Oracle begins the search at the first character of source_char.

■ occurrence is a nonnegative integer indicating the occurrence of the replace operation:
- If you specify 0, then Oracle replaces all occurrences of the match.
- If you specify a positive integer n, then Oracle replaces the nth occurrence.

If occurrence is greater than 1, then the database searches for the second occurrence beginning with the first character following the first occurrence of pattern, and so forth. This behavior is different from the INSTR function, which
begins its search for the second occurrence at the second character of the first occurrence.

■ match_parameter is a text literal that lets you change the default matching behavior of the function. The behavior of this parameter is the same for this function as for REGEXP_COUNT.

The following example examines phone_number, looking for the pattern xxx.xxx.xxxx. Oracle reformats this pattern with (xxx) xxx-xxxx.

SELECT REGEXP_REPLACE(phone_number,
'([[:digit:]]{3})\.([[:digit:]]{3})\.([[:digit:]]{4})',
'(\1) \2-\3') "REGEXP_REPLACE"
FROM employees
ORDER BY "REGEXP_REPLACE";

REGEXP_REPLACE

(515) 123-4444
(515) 123-4567
(515) 123-4568
(515) 123-4569
(515) 123-5555

The following example examines country_name. Oracle puts a space after each non-null character in the string.

SELECT REGEXP_REPLACE(country_name, '(.)', '\1 ') "REGEXP_REPLACE"
FROM countries;

REGEXP_REPLACE
------------------------------------------------------------------
A r g e n t i n a
A u s t r a l i a
B e l g i u m
B r a z i l
C a n a d a

The following example examines the string, looking for two or more spaces. Oracle replaces each occurrence of two or more spaces with a single space.

SELECT REGEXP_REPLACE('500 Oracle Parkway, Redwood Shores, CA',
'( ){2,}', ' ') "REGEXP_REPLACE"
FROM DUAL;

REGEXP_REPLACE
--------------------------------------
500 Oracle Parkway, Redwood Shores, CA
Can you Use CURRVAL or NEXTVAL In the SELECT query of a view ?
No
Consider the following SQL statement:

ALTER TABLE Product
SET UNUSED (prod_name);

Which statements are true regarding the effect of the above statement?

Each correct answer represents a complete solution. Choose all that apply

A: Any view created on the Product table that includes the prod_name column would have to be dropped and recreated.
B: Any synonym existing on the Product table would have to be recreated.
C: The above statement will drop the prod_name along with the Product table.
D: Any constraint defined on the prod_name column would be removed by the above
command.
A: Any view created on the Product table that includes the prod_name column would have to be dropped and recreated.

D: Any constraint defined on the prod_name column would be removed by the above command.
Rules enforced at the table level concerning acceptable data which can be entered into a table are called what?
constraints
What character should separate columns in the SELECT list?
commas
A table can have up to 10,000 columns - True or False ?
1
It removes only the rows that have a NULL value in them - Correct or Incorrect about DELETE FROM statements ?
Incorrect
Which tasks can a user perform with the help of the flashback technology?
Recover tables or rows to a previous point in time / Automatically track and archive transactional data changes / Perform queries that return past data. / Roll back a transaction and its dependent transactions while the database remains online.
What would you use in an INSERT statement instead of a VALUES clause to copy rows from one table to another?
a subquery
Which mandatory clauses should be added to successfully create an external table called Emp?
DEFAULT DIRECTORY
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its
database. The database contains a table named Employees. The marketing members had gone on a recruitment drive for the company, one that turned out to be highly successful. Now the team has asked you to write a SQL statement that will retrieve the days of the week on which more than 10 staff members were hired, as well as the
exact number of employees hired on these days. This other condition must be specified
previously in the SQL statement.

Which of the following SQL statements will you use to accomplish the task?

A: SELECT TO_CHAR(Emp_hire_date, 'day') Emp_hire_day, COUNT(*) FROM EMPLOYEES
GROUP BY TO_CHAR(Emp_hire_date, 'day')
HAVING COUNT(*) >10;

B: SELECT TO_CHAR(Emp_hire_date, 'day') Emp_hire_day, COUNT(*) FROM EMPLOYEES
HAVING COUNT(*) >=10;

C: SELECT TO_CHAR(Emp_hire_date, 'day') Emp_hire_day, COUNT(*) FROM EMPLOYEES
GROUP BY TO_CHAR(Emp_hire_date, 'day')
WHERE COUNT > =10;

D: SELECT TO_CHAR(Emp_hire_date, 'day') Emp_hire_day, COUNT(*) FROM EMPLOYEES
GROUP BY TO_CHAR(Emp_hire_date, 'day')
HAVING COUNT(*) >=10;
A: SELECT TO_CHAR(Emp_hire_date, 'day') Emp_hire_day, COUNT(*) FROM EMPLOYEES
GROUP BY TO_CHAR(Emp_hire_date, 'day')
HAVING COUNT(*) >10;
You disabled the PRIMARY KEY constraint on the id column in the inventory table and updated all the values in the inventory table. You need to enable the constraint and verify that the new id column values do not violate the constraint. If any of the id column values do not conform to the constraint, an error message should be returned.

Evaluate this statement:

ALTER TABLE inventory
ENABLE CONSTRAINT inventory_id_pk;

Which statement is true?

The statement will achieve the desired results.

The statement will execute, but will not enable the PRIMARY KEY constraint.

The statement will execute, but will not verify that values in the ID column do not violate the constraint.

The statement will return a syntax error.
The statement will achieve the desired results
CONVERT()
CONVERT converts a character string from one character set to another.

■ The char argument is the value to be converted. It can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.
■ The dest_char_set argument is the name of the character set to which char is converted.
■ The source_char_set argument is the name of the character set in which char is stored in the database. The default value is the database character set.

The return value for CHAR and VARCHAR2 is VARCHAR2. For NCHAR and NVARCHAR2,
it is NVARCHAR2. For CLOB, it is CLOB, and for NCLOB, it is NCLOB.

Both the destination and source character set arguments can be either literals or columns containing the name of the character set.
You work as a Database Developer for TechSoft Inc. The company uses Oracle as its database. The database has a table named NEW_CUST that stores information of all new customers of the company. You want to load the information of new customers from the NEW_CUST table into two tables called CUST and SPECIAL_CUST.

If a new customer has a credit limit greater than 15,000, the details should get loaded/inserted into the SPECIAL_CUST table, otherwise the details should be loaded/inserted into the CUST table.

Which of the following should be used to load the
data efficiently?

A: Multitable INSERT statement
B: MERGE Command
C: Internal LOBS
D: External table
E: INSERT using WITH CHECK OPTION
A: Multitable INSERT statement
What does the format of my_string have to be in order for the WHERE clause in the following query to evaluate to TRUE? SELECT * FROM dual WHERE REGEXP_LIKE(my_string,'^[a-z]+$');
one or more all alphabetic lowercase characters
What are the two operators that are functionally equivalent to the <> operator?
!= and ^=
Which SQL statement will you use to display a message in the following format?

Outer1 Inner1 Inner2

Here, Outer1, Inner1, and Inner2 are the first, second, and third elements of the
message, respectively.

A: SELECT CONCAT('Outer1' || 'Inner1' || 'Inner2') FROM DUAL;

B: SELECT CONCAT("Outer1", CONCAT("Inner1", "Inner2")) FROM DUAL;

C: SELECT CONCAT('Outer1', CONCAT(' Inner1', 'Inner2')) FROM DUAL;

D: SELECT CONCAT('Outer1', 'Inner1', 'Inner2') FROM DUAL;
C: SELECT CONCAT('Outer1', CONCAT(' Inner1', 'Inner2')) FROM DUAL;
Sequences cannot be used in the subquery of the multitable insert statement - Correct or Incorrect ?
Correct
Which statement correctly grants a system privilege?

A. GRANT EXECUTE
ON prod TO PUBLIC;

B. GRANT CREATE VIEW
ON tablel TO used;

C. GRANT CREATE TABLE
TO used ,user2;

D. GRANT CREATE SESSION
TO ALL;
C
In which clause of a SELECT statement can a column alias NOT be used?
A column alias CANNOT be used in a WHERE clause.
You work as a Database Administrator for Gadgets Inc. The company uses Oracle as its
database. The database contains a table named Employees. The table consists of columns, namely Emp_id, Emp_name, Emp_dept, Emp_cnt, Emp_desig, and Emp_add.

Now, you want to view the table schema.

Which of the following commands or packages will you use to accomplish the task?

A: COMMIT
B: DBMS_STATS
C: DESC
D: DBMS_SYSTEM
E: ROLLBACK
C: DESC
You want to retrieve the address of all those employees who provide technical support and have joined after the year 2007. Which queries will you use to accomplish the task?
SELECT emp_add FROM employee WHERE job_desig = 'tech_support' AND join_date > '31-dec-2007';
SELECT Brand, Series, COUNT(*) FROM CompProducts GROUP BY Brand, CUBE(Series, Type); Which statements is TRUE about the given query?
The number of computers of every series of every brand is displayed / Grand total is not displayed by this query
It calculates a grand total of all the groups - Correct or Incorrect about ROLLUP operation ?
Correct
Within which statements can a view be created by embedding a subquery?
CREATE VIEW
If A and B are joined by multiple join conditions, then you must use the (+) operator in all of these conditions - Correct or Incorrect about using Oracle Join Operator ( + ) ?
Correct
Single-Row Functions execute once for each record processed - True or False ?
1
Fill in the blank with a numeric function to get 15 as the output --- SELECT __________ (-15) "Absolute" FROM DUAL;
ABS
Roles are named groups of related privileges that can be granted to users or other roles - Correct or Incorrect about ROLES ?
Correct
They can be used to retrieve multiple rows from a single table only - True or False regarding Multiple-row Subquery ?
1
It does not have any usage of SQL group functions or grouping of data - Correct or Incorrect about Simple View ?
Correct
MIN()
MIN returns minimum value of expr. You can use it as an aggregate or analytic function.

The following statement returns the earliest hire date in the hr.employees table:

SELECT MIN(hire_date) "Earliest"
FROM employees;

Earliest
---------
13-JAN-01
A view is like a logical table - Correct or Incorrect about VIEWS ?
Correct
Which clause of the ALTER TABLE statement would you use to add a NOT NULL constraint to an existing table?
the MODIFY clause
All the constraints can be defined at the column level as well as the table level - True or False ?
1
Which types of constraint require an index?
PRIMARY KEY, UNIQUE
Can You Use CURRVAL or NEXTVAL In the WHERE clause of a SELECT statement ?
No
It retrieves all versions including the deleted as well as subsequently reinserted versions of the rows - Correct or Incorrect about FLASHBACK Version Query?
Correct
Which two categories of statements cause an autocommit to occur?
DCL and DDL statements
An external table is a read-write source - Correct or Incorrect about EXTERNAL tables ?
Incorrect
A co-related sub query can be used in UPDATE statements to update data from other tables - Correct or Incorrect about UPDATE statements ?
Correct
In the EMP table, the primary key is Emp_id; and in the DEPT table the composite primary key is (Dept_id, Emp_id).

Which of the following are valid create index statements?

Each correct answer represents a complete solution. Choose two.

A: CREATE INDEX Emp_idx
ON DEPT(Emp_id);

B: CREATE INDEX Emp_idx
ON EMP(Emp_id);

C: CREATE INDEX Emp_idx
ON EMP, DEPT(Emp_id, Dept_id, Dept_name);

D: CREATE INDEX Emp_idx
ON DEPT(Dept_id);
A: CREATE INDEX Emp_idx
ON DEPT(Emp_id);

D: CREATE INDEX Emp_idx
ON DEPT(Dept_id);
CURRENT_DATE()
CURRENT_DATE returns the current date in the session time zone, in a value in the Gregorian calendar of data type DATE.

The following example illustrates that CURRENT_DATE is sensitive to the session time
zone:

ALTER SESSION SET TIME_ZONE = '-5:0';
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';

SELECT SESSIONTIMEZONE, CURRENT_DATE FROM DUAL;

SESSIONTIMEZONE CURRENT_DATE
--------------- --------------------
-05:00 29-MAY-2000 13:14:03

ALTER SESSION SET TIME_ZONE = '-8:0';
SELECT SESSIONTIMEZONE, CURRENT_DATE FROM DUAL;

SESSIONTIMEZONE CURRENT_DATE
--------------- --------------------
-08:00 29-MAY-2000 10:14:33
Consider the following two SQL statements:

ALTER TABLE EMPLOYEE
DROP COLUMN LAST_NAME;

Which of the following statements are true regarding the above two SQL statements?

Each correct answer represents a complete solution. Choose all that apply.

A: The Last_Name column would not be dropped.

B: The Last_Name column can be dropped even if it is a part of a composite PRIMARY KEY provided the cascade option is used.

C: The Last_Name column would be dropped provided at least one or more columns remain in the table.

D: The Last_Name column can be rolled back provided the SET_UNUSED option is added to the above SQL Statement.
B: The Last_Name column can be dropped even if it is a part of a composite PRIMARY KEY provided the cascade option is used.

C: The Last_Name column would be dropped provided at least one or more columns remain in the table.
For which of the following purposes you cannot use scalar subqueries?

Each correct answer represents a complete solution. Choose all that apply.

A: WHEN condition of triggers

B: START WITH and CONNECT BY clauses

C: GROUP BY and HAVING clauses

D: CHECK constraints on columns
A: WHEN condition of triggers

B: START WITH and CONNECT BY clauses

C: GROUP BY and HAVING clauses

D: CHECK constraints on columns
Which is a comparison operator that is used to compare a value with a NULL value?
IS NOT NULL
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its database. The database contains a table named Employees. You want to retrieve Emp_id, Emp_name, and Emp_join_date of all those employees who have worked for more than 24 months since their joining date till 01-JAN-2008.

Which of the following SQL queries will you use to accomplish the task?

A: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE MONTHS_BETWEEN ('01-JAN-2008', Emp_join_date) >24;

B: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE MONTHS_BETWEEN (Emp_join_date, '01-JAN-2008') >24;

C: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE Emp_join_date BETWEEN Emp_join_date AND '01-JAN-
2008';

D: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE Emp_join_date IN (Emp_join_date, '01-JAN-2008');
A: SELECT Emp_id, Emp_name, Emp_join_date
FROM Employees WHERE MONTHS_BETWEEN ('01-JAN-2008', Emp_join_date) >24;
The sum of all the INTO columns cannot exceed 999 in case of Multi table Insert -- Correct or Incorrect ?
Correct
Evaluate the following expression using meta character for regular expression:

'[AAle|ax.r$]'

Which two matches would be returned by this expression? (Choose two.)
A. Alex
B. Alax
C. Alxer
D. Alaxendar
E. Alexender
D,E
Which is used to restrict the rows returned by a query?
WHERE clause
View the Exhibit and examine the structure of the EMP table.

You executed the following command to add a primary key to the EMP table:

ALTER TABLE emp
ADD CONSTRAINT emp_id_pk PRIMARY KEY (emp_id) USING INDEX emp_id_idx;

Which statement is true regarding the effect of the command?

A. The PRIMARY KEY is created along with a new index.

B. The PRIMARY KEY is created and it would use an existing unique index.

C. The PRIMARY KEY would be created in a disabled state because it is using an existing index.

D. The statement produces an error because the USING clause is permitted only in the CREATE
TABLE command.
B
The HAVING clause conditions can have aggregate functions - Correct or Incorrect ?
Correct
What are the possible values that the GROUPING function can return?
0 / 1
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its database. The database contains a table named Employee.

The structure of the table is given below :

Emp_id Emp_name Emp_address Emp_contact Emp_commission

You want to fetch the names of those employees who do not earn any commission.

Therefore, you issue the following query by using SQL Developer:

SELECT Emp_name FROM EMPLOYEE
WHERE Emp_commission = NULL;

What will be the result of executing the above SQL statement?

A: It will return the rows that have non-null values in the Emp_commission column.

B: It will display an error message mentioning inappropriate use of operator.

C: It will retrieve the names of those employees whose commission is NULL.

D: It will not return any rows and will also not display any error message
D: It will not return any rows and will also not display any error message
What is the name of the function which allows you to determine the exact GROUP BY level when using any of the GROUPING functions?
GROUPING_ID
Which types of join is used to join two tables and involves a join condition using the OUTER JOIN operator with one or more columns of either of the two tables.
Outer join
What value is returned after executing the following statement? Take note that 01-JAN-2009 occurs on a Thursday. SELECT NEXT_DAY('01-JAN-2009','wed') FROM DUAL;
7-Jan-09
Views with the same name but different prefixes, such as DBA, ALL and USER, use the same base tables from the data dictionary - Correct or Incorrect about VIEWS ?
Correct
Assuming SYSDATE=30-DEC-2007, what value is returned after executing the following statement? SELECT TRUNC(SYSDATE,'YEAR') FROM DUAL;
1-Jan-07
Which comparison operator compares a value to every value returned by a subquery?
ALL
DML operations are allowed on the view - Correct or Incorrect about Simple View ?
Correct
What type of conversion is performed by the following statement? SELECT LENGTH(3.14285) FROM DUAL;
Implicit conversion
ROWIDTONCHAR()
ROWIDTONCHAR()

ROWIDTONCHAR converts a rowid value to NVARCHAR2 data type. The result of this
conversion is always in the national character set and is 18 characters long.
A view contains no data in it - Correct or Incorrect about VIEWS ?
Correct
It is not possible to revoke the privileges that are granted with system privileges - Correct or Incorrect about System privileges ?
Correct
What are distinguishing characteristics of heap tables?
A heap can store variable length rows. / Rows in a heap are in random order
Which SQL statements is used to create a backup copy of all the rows present in a table?
CREATE TABLE...AS SELECT statement
What are the clauses that a basic SELECT statement should always include?
FROM, SELECT
SELECT NVL(1234) FROM DUAL; - Correct or Incorrect ?
Incorrect
Which statement ends the current transaction by disregarding all pending changes?
ROLLBACK
No index can be defined on an external table - Correct or Incorrect ?
Correct
It can be used to add rows to a table by setting values to all of the columns - Correct or Incorrect about UPDATE statements ?
Incorrect
Which of the following table is used to store new data in the first available slot?
Heap table
Which data dictionary view would you query to display objects you can access either by privileges explicitly granted to you or by privileges granted to PUBLIC?
ALL_COL_PRIVS_RECD
RAWTONHEX()
RAWTONHEX()

RAWTONHEX converts raw to a character value containing its hexadecimal representation.

RAWTONHEX (raw) is equivalent to TO_NCHAR(RAWTOHEX(raw)). The value returned is always in the national character set.
The inventory table contains these columns:

id_number NUMBER PK
category VARCHAR2(10)
location NUMBER
description VARCHAR2(30)
price NUMBER(7,2)
quantity NUMBER

You want to return the total of the extended amounts for each item category and location, including only those inventory items that have a price greater than $100.00. The extended amount of each item equals the quantity multiplied by the price.

Which SQL statement will return the desired result?

SELECT category, SUM(price * quantity) TOTAL, location FROM inventory WHERE price > 100.00;

SELECT category, location, SUM(price)
FROM inventory
WHERE price > 100.00 GROUP BY category, location;

SELECT category, SUM(price * quantity) TOTAL, location FROM inventory
WHERE price > 100.00 GROUP BY category;

SELECT category, SUM(price * quantity) TOTAL, location FROM inventory
WHERE price > 100.00 GROUP BY category, location;
SELECT category, SUM(price * quantity) TOTAL, location
FROM inventory WHERE price > 100.00
GROUP BY category, location;
Evaluate the following SQL statements executed in the given order:

ALTER TABLE cust
ADD CONSTRAINT cust_id_pk PRIMARY KEY(cust_id) DEFERRABLE INITIALLY DEFERRED;

INSERT INTO cust VALUES (1,'RAJ1); --row 1

INSERT INTO cust VALUES (1,'SAM); --row 2

COMMIT;

SET CONSTRAINT cust_id_pk IMMEDIATE;

INSERT INTO cust VALUES (1,'LATA'); --row 3

INSERT INTO cust VALUES (2,'KING'); --row 4

COMMIT;

Which rows would be made permanent in the CUST table?

A. row 4 only
B. rows 2 and 4
C. rows 3 and 4
D. rows 1 and 4
C
What is the problem with the sub-query in the below exhibit?

SQL> INSERT INTO SAMPLE (SELECT * FROM EMP);
INSERT INTO SAMPLE (SELECT * FROM EMP)
*
ERROR at line 1:
ORA-00913: too many values

A: SAMPLE.EMPNO is not set to NOT NULL as EMP.EMPNO.

B: SELECT * is not allowed in a sub-query, column names have to be specified

C: The number of columns that the sub-query returns is inconsistent with the number of columns in the outer query.

D: There is a data type mismatch in the above queries.
C: The number of columns that the sub-query returns is inconsistent with the number of columns in the outer query.
The column names for the rows to be inserted must match the column names in the subquery - Correct or Incorrect about Multi table Insert ?
Incorrect
What type of Multi Table INSERT does the given SQL depict?

INSERT ALL
INTO T1 VALUES (<value list>, ...)
INTO T2 VALUES (<value list>, ...)
INTO T3 VALUES (<value list>, ...)
INTO T4 VALUES (<value list>, ...)
INTO T5 VALUES (<value list>, ...)
INTO T6 VALUES (<value list>, ...)
INTO T7 VALUES (<value list>, ...)
SELECT <column list>, ...
FROM T8
WHERE <condition>;

A: Unconditional INSERT ALL
B: Conditional INSERT FIRST
C: Conditional INSERT ALL
D: Conditional INSERT ELSE
A: Unconditional INSERT ALL
When using a LIKE condition to perform pattern matching, what does an underscore represent?
any single character
Evaluate the following INSERT statement:

INSERT ALL
WHEN order_total < 10000 THEN
INTO small_orders
WHEN order_total > 10000 AND order_total < 50000 THEN
INTO medium_orders
WHEN order_total > 50000 THEN
INTO large_orders
SELECT order_id, order_total, customer_id
FROM Orders;

Which of the following statements is true regarding the evaluation of rows returned by
the sub query in the INSERT statement?

A: They are evaluated by the first WHEN clause. If the condition is false, then the row would be evaluated by the subsequent WHEN clauses.

B: They are evaluated by all the three WHEN clauses regardless of the results of the
evaluation of any other WHEN clause.

C: The INSERT statement would give an error message.

D: They are evaluated by the first WHEN clause. If the condition is true, then the row would be evaluated by the subsequent WHEN clauses.
B: They are evaluated by all the three WHEN clauses regardless of the results of the evaluation of any other WHEN clause.
Which metacharacter, when used in a SQL regular expression, represents a match to any character in the database character set?
the period (.)
Can a group function be included in a HAVING clause?
Yes
User SCOTT in the PROD database has a table called EMP. He wants to give select
access on this table to all the users in the database.

Which of the following commands should you use to accomplish this task?

A: GRANT ALL ON EMP TO PUBLIC;

B: GRANT ALL ON EMP TO ALL;

C: GRANT SELECT ON EMP TO ALL;

D: GRANT SELECT ON EMP TO PUBLIC
D: GRANT SELECT ON EMP TO PUBLIC;
In which specific area of database administration are the keywords CUBE, ROLLUP, and GROUPING SETS are most often used?
Data Warehousing
A WHERE condition containing the (+) operator cannot be combined with another condition using the OR logical operator - Correct or Incorrect about using Oracle Join Operator ( + ) ?
Correct
View the exhibit and examine the details of the Employee table:

EMP_ID LAST_NAME JOB_ID MANAGER_ID
201 Peter MK_MAN 200
101 Morris AD_VP 200
231 David AD_VP 200
121 Fillipps ST_MAN 200
211 Harriston ST_MAN 200
102 Garten SA_MAN 201
122 Darill AS_ASST 201

You want to generate a hierarchical report for all the employees who report to the employee whose EMP_ID is 200.

Which of the following SQL clauses would you require to accomplish the task?

Each correct answer represents a complete
solution. Choose all that apply.

A: START WITH
B: GROUP BY
C: CONNECT BY
D: ORDER BY
E: WHERE
A: START WITH
C: CONNECT BY
E: WHERE
External tables are read only, so no DML operation can be performed on them - Correct or Incorrect ?
Correct
The USER_OBJECTS view can provide information about the tables and views created by the permanent users only - Correct or Incorrect about VIEWS ?
Incorrect
It is used to set the order for the groups to be used for calculating the grand totals and subtotals - Correct or Incorrect about GROUPING function ?
Incorrect
Which group functions can return character and date results?
MIN
Which of the following operators return TRUE if both component conditions are TRUE and return FALSE if either is FALSE; otherwise returns UNKNOWN?
AND
A character value may be converted to a date value using the TO_DATE function - True or False ?
TRUE
LENGTH()
The LENGTH functions return the length of char. LENGTH calculates length using characters as defined by the input character set. LENGTHB uses bytes instead of characters. LENGTHC uses Unicode complete characters. LENGTH2 uses UCS2 code points. LENGTH4 uses UCS4 code points.

char can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or
NCLOB. The exceptions are LENGTHC, LENGTH2, and LENGTH4, which do not allow
char to be a CLOB or NCLOB. The return value is of data type NUMBER. If char has data type CHAR, then the length includes all trailing blanks. If char is null, then this function returns null.

The LENGTHB function is supported for single-byte LOBs only. It cannot be used with CLOB and NCLOB data in a multibyte character set.

The following example uses the LENGTH function using a single-byte database character set:

SELECT LENGTH('CANDIDE') "Length in characters" FROM DUAL;

Length in characters
--------------------
7
You have created an index with this statement: create index ename_i on employees(last_name,first_name); How can you adjust the index to include the employees’ birthdays, which is a date type column called DOB?
You must drop the index and re-create it.
System privileges confer on the grantee a group of roles, objects, and other privileges - Correct or Incorrect about System Privileges ?
Incorrect
Can any user who owns an object grant object privileges for that object?
Yes
A constraint can be disabled even if the constraint column contains data - True or False ?
1
The query name in the WITH clause is visible to other query blocks in the WITH clause as well as to the main query block - Correct or Incorrect regarding the usage of WITH clause in complex correlated queries ?
Correct
Tasks Performed By - DECODE --
Used to translate an expression after comparing it with each search value.
The database object that stores lookup information to speed up querying in tables is:
INDEX
Marking a column as unused and then using the alter table name drop unused column statement is useful because it allows the DBA to take away column access quickly and immediately - Correct or Incorrect about UNUSED column ?
Correct
Which commands will terminate a transaction?
COMMIT / ROLLBACK / TRUNCATE
It is not possible to specify NULL or NOT NULL in a view constraint - Correct or Incorrect about NOT NULL constraint ?
Correct
The WHERE clause can be used to have your update affects a specific set of rows - Correct or Incorrect about UPDATE statement ?
Correct
The current date is July 19, 2011. You need to store this date value:

19-OCT-99

Using that date value as written, and assuming it is to be INSERTed into a table using a corresponding format mask, which statement below describing that format mask is true?

Both the YY and RR date formats will interpret the year as 1999.

Both the YY and RR date formats will interpret the year as 2099.

The RR date format will interpret the year as 2099, and the YY date format will interpret the year as 1999.

The RR date format will interpret the year as 1999, and the YY date format will interpret the year as 2099.
The RR date format will interpret the year as 1999, and the YY date format will interpret the year as 2099.
View the Exhibit and examine the description of the ORDERS table.

The orders in the ORDERS table are placed through sales representatives only. You are given the task to get the SALES_REP_ID from the ORDERS table of those sales representatives who have successfully referred more than 10 customers.

Which statement would achieve this purpose?

A. SELECT sales_rep_id, COUNT(customer_id) "Total"
FROM orders "
HAVING COUNT(customer_id) > 10;

B. SELECT sales_rep_id, COUNT(customer_id) "Total"
FROM orders "
WHERE COUNT(customer_id) > 10
GROUP BY sales_rep_id;

C. SELECT sales_rep_id, COUNT(customer_id) "Total"
FROM orders "
GROUP BY sales_rep_id
HAVING total > 10;

D. SELECT sales_rep_id, COUNT(customer_id) "Total"
FROM orders "
GROUP BY sales_rep_id
HAVING COUNT(customer_id) > 10;
D
View the Exhibit and examine the details of the EMPLOYEES table.

Evaluate the following SQL statement:

SELECT phone_number,
REGEXP_REPLACE(phone_number,'([[: digit: ]]{3})\.([[: digit: ]]{3})\.([[: digit: ]]{4})', ,(\1)\2-\3')
"PHONE NUMBER" FROM employees;

The query was written to format the PHONE_NUMBER for the employees. Which option would be the correct format in the output?

A. xxx-xxx-xxxx
B. (xxx) xxxxxxx
C. (xxx) xxx-xxxx
D. xxx-(xxx)-xxxx
C
TRUNC (number)
TRUNC (number)

The TRUNC (number) function returns n1 truncated to n2 decimal places. If n2 is omitted, then n1 is truncated to 0 places. n2 can be negative to truncate (make zero) n2 digits left of the decimal point.

This function takes as an argument any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. If you omit n2, then the function returns the same data type as the numeric data type of the argument. If you include n2, then the function returns NUMBER.

The following examples truncate numbers:

SELECT TRUNC(15.79,1) "Truncate" FROM DUAL;
Truncate
----------
15.7

SELECT TRUNC(15.79,-1) "Truncate" FROM DUAL;
Truncate
----------
10
Which comparison operator identifies values that are equal to or larger than a particular value?
>= (greater than or equal to)
You work as a Database Developer for TechSoft Inc. The company uses Oracle as its Database. The database has a table named NEW_CUST that stores information of all new customers of the company. You want to load the information of new customers from the NEW_CUST table into two tables called CUST and SPECIAL_CUST.

If a new customer has a credit limit greater than 15,000, the details should get loaded/inserted into the SPECIAL_CUST table, otherwise the details should be loaded/inserted into the CUST table.

Which of the following should be used to load the
data efficiently?

A: Multitable INSERT statement
B: SQL* Loader
C: Merge command
D: External table
A: Multitable INSERT statement
Group Functions can be used along with the single-row function in the SELECT clause of a SQL statement - Correct or Incorrect ?
Correct
Which SELECT statement clause would you use to override the implicit sorting of a GROUP BY clause?
an ORDER BY clause
Which of the following SQL queries will generate an output of 5#6#7#8#9#?

Each correct answer represents a complete solution. Choose two.

A: SELECT SUBSTR('1#2#3#4#5#6#7#8#9#',9) FROM DUAL;

B: SELECT INSTR('1#2#3#4#5#6#7#8#9#',5,8) FROM DUAL;

C: SELECT INSTR('1#2#3#4#5#6#7#8#9#',5,12) FROM DUAL;

D: SELECT SUBSTR
('1#2#3#4#5#6#7#8#9#',9,10) FROM DUAL;
A: SELECT SUBSTR('1#2#3#4#5#6#7#8#9#',9) FROM DUAL;

D: SELECT SUBSTR('1#2#3#4#5#6#7#8#9#',9,10) FROM DUAL;
SELECT REGEXP_REPLACE(WebReference, 'ht{2}ps:/{2}','ht{2}p:/{2} w{3}.') FROM PublishedBooks; Which statements is TRUE about the given query?
https:// is replaced with http://www.
Updates are not allowed through a view if the view definition includes columns that are defined by what?
expressions
You work as a Database Developer for Gadgets Inc. The company uses Oracle as its database. The database has a table named Accounts. You want to retrieve rows from Accounts table.

For this purpose, you issue the following SQL statement:

SELECT * FROM Accounts WHERE Salary < = 5000 OR Salary > = 10000

The statement retrieves the rows having salary less than or equal to Rs. 5000 or greater than or equal to Rs. 10,000.

Which of the following characters will you use to
terminate and execute the above statement?

Each correct answer represents a complete solution. Choose two

A: A semicolon (;)
B: A colon (:)
C: A forward slash (/)
D: A backslash (\)
A: A semicolon (;)
C: A forward slash (/)
Dynamic performance views are continuously updated while a database is open and in use - correct or Incorrect about VIEWS ?
Correct
You work as a Database Developer for Dolliver Inc. The company uses Oracle as its
database. The database contains a table named Employee. Details of the last_name column in the table are given below:

Mixfeary
Iftikaar
Mirgous
Lirentz
Suzaine
Ginny

You issue the following SQL statement on the Employee table to restrict the result set:

SELECT last_name
FROM Employee
WHERE last_name LIKE '_i%';

What will be the result set of the above SQL statement?

A: Mixfeary, Mirgous, Lirentz
B: Mixfeary, Iftikaar, Lirentz, Ginny
C: Mixfeary, Ginny
D: Mixfeary, Mirgous, Lirentz, Ginny
D: Mixfeary, Mirgous, Lirentz, Ginny
It is used to find the groups forming the subtotal in a row - Correct or Incorrect about GROUPING function ?
Correct
What keyword must be included in the equality condition in a hierarchical query, on one side or the other of the equal sign?
PRIOR
A WHERE clause condition that uses < ALL will return all records where the value is ______.
a value less than the minimum returned by the subquery
The SYSDATE function returns the host machine date and time - True or False ?
1
A view can fetch data from multiple tables - Correct or Incorrect about VIEWS ?
Correct
Which three functions allow you to perform explicit datatype conversions?
TO_CHAR, TO_DATE, and TO_NUMBER
Which of the following statements will grant the role OMBUDSMAN to user JOSHUA in such a way that JOSHUA may grant the role to another user?
GRANT OMBUDSMAN TO JOSHUA WITH ADMIN OPTION;
Synonyms are used to shorten the data of the table - Correct or Incorrect about SYNONYMS ?
Incorrect
Which system privileges or roles should be granted to a new database user to connect to the database?
CREATE SESSION / CONNECT
Can you Use CURRVAL or NEXTVAL in a A SELECT statement with the DISTINCT operator ?
No
Tasks Performed By -- COUNT --
Used to count the number of records present in a column of a table.
Which schema objects supports the INDEX privilege?
Table
Which datatype includes a time zone displacement value that allows Oracle to return data to the client in the user's local session time zone?
TIMESTAMP WITH LOCAL TIME ZONE
User JOHN updates some rows and asks user ROOPESH to log in and check the changes before he commits them. Which statements is true?
ROOPESH will not be able to see the changes
To satisfy a NOT NULL constraint, every row in the table must contain a value for the column - Correct or Incorrect about NOT NULL constraint ?
Correct
Which is a collection of DML statements that form a logical unit of work?
Transaction
A column with the UNIQUE constraint can contain NULL - Correct or Incorrect regarding Constraints ?
Correct
Which commands is used to grant system level privileges?
Grant
View the Exhibit and examine the structure of the ORDERS table.

The columns ORDER_MODE
and ORDER_TOTAL have the default values 'direct' and 0 respectively.

Which two INSERT statements are valid? (Choose two.)

A. INSERT INTO orders
VALUES (1, O9-mar-2007', 'online',",1000);

B. INSERT INTO orders
(order_id ,order_date ,order_mode,
customer_id ,order_total)
VALUES(1 ,TO_DATE(NULL), 'online', 101, NULL);

C. INSERT INTO
(SELECT order_id ,order_date .customer_id
FROM orders)
VALUES (1,O9-mar-2007', 101);

D. INSERT INTO orders
VALUES (1,09-mar-2007', DEFAULT, 101, DEFAULT);

E. INSERT INTO orders
(order_id ,order_date ,order_mode .order_total)
VALUES (1 ,'10-mar-2007','online',1000);
C,D
You have been asked to produce a report of all instructors, including the classes taught by each instructor. All instructors must be included on the report, even if they are not currently assigned to teach classes
.
Which two SELECT statements could you use? (Choose two.)

SELECT i.last_name, i.first_name, c.class_name
FROM instructor i, class c;

SELECT i.last_name, i.first_name, c.class_name
FROM class c LEFT OUTER JOIN instructor i
ON (i.instructor_id = c.instructor_id)
ORDER BY i.instructor_id;

SELECT i.last_name, i.first_name, c.class_name
FROM instructor i, class c
WHERE i.instructor_id = c.instructor_id (+)
ORDER BY i.instructor_id;

SELECT i.last_name, i.first_name, c.class_name
FROM instructor i LEFT OUTER JOIN class c
ON (i.instructor_id = c.instructor_id)
ORDER BY i.instructor_id;

SELECT i.last_name, i.first_name, c.class_name
FROM instructor i, class c
WHERE i.instructor_id (+) = c.instructor_id
ORDER BY i.instructor_id;

SELECT i.last_name, i.first_name, c.class_name
FROM instructor i NATURAL JOIN class c
ON (i.instructor_id = c.instructor_id);
SELECT i.last_name, i.first_name, c.class_name
FROM instructor i, class c
WHERE i.instructor_id = c.instructor_id (+)
ORDER BY i.instructor_id;

SELECT i.last_name, i.first_name, c.class_name
FROM instructor i LEFT OUTER JOIN class c
ON (i.instructor_id = c.instructor_id)
ORDER BY i.instructor_id;
HEXTORAW()
HEXTORAW converts char containing hexadecimal digits in the CHAR, VARCHAR2,
NCHAR, or NVARCHAR2 data type to a raw value.

This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion.
You work as a Database Administrator for Dolliver Inc. The company uses an Oracle database. The database contains a table named Employee that keeps the record of all employees in the company.

You issue the following SELECT statement to select some details of an employee and also set the filter by using the WHERE clause:

SELECT Emp_ID, Emp_Name, Dept_ID
FROM Employee
WHERE Salary > AVG (Salary)
ORDER BY Emp_Name;

Which of the following statements is true about the SELECT statement?

A: The SELECT statement will return only the employee names.

B: The SELECT statement will return only the employee IDs.

C: The SELECT statement will return an error.

D: The SELECT statement will return only the department IDs.
C: The SELECT statement will return an error.
GROUP BY is used to divide a database table into groups based on group columns - Correct or Incorrect ?
Correct
Evaluate this SQL script:

CREATE USER hr IDENTIFIED BY hr01;
CREATE ROLE hr_director;
GRANT hr_director TO hr;
GRANT SELECT ON teacher TO hr_director;
DROP USER hr;

After the conclusion of this script, how many users are granted the hr_director role, and how many privileges are granted to the hr_director role?

one user and one privilege
one user and no privileges
no users and one privilege
no users and no privileges
no users and one privilege
Which clauses can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns?
GROUP BY
You want to retrieve the average income of the departments from the Department table if the lowest income among the departments is $50,000.

Which of the following SQL statements will you use to accomplish the task?

Each correct answer represents a complete solution. Choose two

A: SELECT AVG (CASE WHEN d.dept_income > 50000 THEN d.dept_income ELSE
50000; END CASE;) "Average department income" FROM department d;

B: CASE WHEN d.dept_income > 50000 THEN d.dept_income ELSE 50000; END CASE;
"Average salary" FROM department d;

C: SELECT AVG (CASE WHEN d.dept_income > 50000 THEN d.dept_income ELSE
50000; END CASE;) FROM department d;

D: CASE WHEN d.dept_income > 50000 THEN d.dept_income ELSE 50000; END CASE;
FROM department d;
A: SELECT AVG (CASE WHEN d.dept_income > 50000 THEN d.dept_income ELSE
50000; END CASE;) "Average department income" FROM department d;

C: SELECT AVG (CASE WHEN d.dept_income > 50000 THEN d.dept_income ELSE
50000; END CASE;) FROM department d;
Which meta characters functions will you use to get only those rows that match a given regular expression?
REGEXP_LIKE
Consider the following statement:

CREATE TABLE reservations
(
id NUMBER,
cust_id NUMBER,
origin NVARCHAR(30),
destination NVARCHAR(30),
travel_date DATETIME CONSTRAINT date_chk CHECK
(REGEXP_LIKE(travel_date, '\A\d{4}?-\w{3, 9}?-\d{2}?\Z')) );

Which of the following statements are TRUE about the given constraint? (Choose two.)

14-Oct-2009 can be inserted as the travel_date into the reservations table

54-OCTOBER-2009 can be inserted as the travel_date into the reservations table

2009-Oct-14 can be inserted as the travel_date into the reservations table

2009-OCTOBER-09 can be inserted as the travel_date into the reservations table
2009-Oct-14 can be inserted as the travel_date into the reservations table

2009-OCTOBER-09 can be inserted as the travel_date into the reservations table
If the subquery returns no rows, then the value is considered to be zero - Correct or Incorrect about Scaler subquery ?
Incorrect
The database administrator creates and maintains the data dictionary view - Correct or Incorrect about VIEWS ?
Incorrect
You must display the order number, line item number, product identification number, and quantity of each item where the quantity ranges from 10 through 100. The order numbers must be in the range of 1500 through 1575.

The results must be sorted by order number from lowest to highest and then further sorted by quantity from highest to lowest.

Which statement should you use to display the desired results?

SELECT order_id, line_item_id, product_id, quantity FROM line_item
WHERE quantity BETWEEN 9 AND 101
AND order_id BETWEEN 1500 AND 1575
ORDER BY order_id DESC, quantity DESC;

SELECT order_id, line_item_id, product_id, quantity FROM line_item
WHERE (quantity > 10 AND quantity < 100)
AND order_id BETWEEN 1500 AND 1575
ORDER BY order_id ASC, quantity;

SELECT order_id, line_item_id, product_id, quantity FROM line_item
WHERE (quantity > 9 OR quantity < 101)
AND order_id BETWEEN 1500 AND 1575
ORDER BY order_id, quantity;

SELECT order_id, line_item_id, product_id, quantity FROM line_item
WHERE quantity BETWEEN 10 AND 100
AND order_id BETWEEN 1500 AND 1575
ORDER BY order_id, quantity DESC;
SELECT order_id, line_item_id, product_id, quantity
FROM line_item WHERE quantity BETWEEN 10 AND 100
AND order_id BETWEEN 1500 AND 1575 ORDER BY order_id, quantity DESC;
The datatype of the value returned by the GROUPING function is Oracle CHARACTER - Correct or Incorrect about GROUPING function ?
Incorrect
Can a row be both the child and parent of a given row?
No
Rows cannot be deleted through a view if the view definition contains the DISTINCT keyword - Correct or Incorrect about VIEWS ?
Correct
A number value may be converted to a date value using the TO_DATE function - True or False ?
1
Which function compares two expressions, returning NULL if the expressions are equal and returning the first expression if the expressions are not equal?
the NULLIF function
REVOKE REFERENCES ON inventory FROM joe CASCADE CONSTRAINTS; Which two tasks were accomplished by executing this statement?
All the FOREIGN KEY constraints on the INVENTORY table created by user Joe were removed / The ability to create a FOREIGN KEY constraint on the INVENTORY table was revoked from user Joe
What is a subquery called when a nested subquery references a column from a table referred to a parent statement any number of levels above the subquery?
Correlated Subquery
A public synonym and a private synonym can exist with the same name for the same table - Correct or Incorrect about Synonyms ?
Correct
User SCOTT in the PROD database has a table called EMP. He wants to give select access on this table to all the users in the database. Which commands should you use to accomplish this task?
GRANT SELECT ON EMP TO PUBLIC;
A public synonym and a private synonym can exist with the same name for the same table - Correct or Incorrect about SYNONYMS ?
Correct
Which functions are conversion functions?
COMPOSE, CHARTOROWID
Which are the system level privileges?
SYSOPER / SELECT ANY TABLE / SYSDBA
To create another name for an object, and make that name available to the entire database, you would create which of the following?
PUBLIC SYNONYM
In a SELECT statement, subqueries are often used in which clause to return values for an unknown conditional value?
a WHERE clause
What datatype would be used to store binary data in an external file?
BFILE
Which clauses helps a user to use a query block repeatedly in the main query?
WITH
Which of the following queries will provide information about the number of employees working under each manager and classify them based on their designation for each manager?
SELECT MGR, JOB, COUNT (*) AS TOTAL FROM EMP GROUP BY ROLLUP (MGR, JOB);
What are the two ways in which a user can use the INSERT statement to insert data into a table, partition, or view?
Conventional INSERT and Direct-path INSERT
A foreign key cannot contain NULL values - Correct or Incorrect regarding Constraints ?
Incorrect
Which flashback features is used to retrieve metadata and historical data for a specific time interval?
FLASHBACK VERSION QUERY
The EMP table contains all the details of the employees and the EMP_BONUS_2009
table contains the new salary for employees including their performance bonuses for
the year 2009.

Which of the following queries should you use to update the SAL column of the EMP table with the new SAL values from the EMP_BONUS_2009 table?

A: UPDATE EMP A
SET A.SAL= (SELECT B.SAL FROM EMP_BONUS_2009 B);

B: UPDATE EMP A
SET B.SAL= (SELECT A.SAL FROM EMP_BONUS_2009 B
WHERE A.EMPNO=B.EMPNO);

C: UPDATE EMP
SET SAL= (SELECT B.SAL FROM EMP_BONUS_2009 B
WHERE EMPNO=B.EMPNO);

D: UPDATE EMP A
SET A.SAL= (SELECT B.SAL FROM EMP_BONUS_2009 B
WHERE A.EMPNO=B.EMPNO);
D: UPDATE EMP A
SET A.SAL= (SELECT B.SAL FROM EMP_BONUS_2009 B WHERE A.EMPNO=B.EMPNO);
COUNT()
COUNT returns the number of rows returned by the query. You can use it as an aggregate or analytic function.

If you specify expr, then COUNT returns the number of rows where expr is not null.
You can count either all rows, or only distinct values of expr.

If you specify the asterisk (*), then this function returns all rows, including duplicates and nulls. COUNT never returns null
You work as a Database Administrator for Doliiver Inc. The company uses Oracle as its database. You want to find out the difference between two date values.

For this purpose you use the following SQL query:

SELECT MONTHS_BETWEEN('15-JAN-2008', '25-MAY-2008') FROM DUAL;

What will be the result of the above SQL query?

A: -4.3225806
B: 4.3225806
C: 4
D: -4
A: -4.3225806
Evaluate the following CREATE TABLE command:

CREATE TABLE order_item (order_id NUMBER(3),
Item_id NUMBER(2),
qtyNUMBER(4),
CONSTRAINT ord_itm_id_pk
PRIMARY KEY (order_id jtem_id)
USING INDEX
(CREATE INDEX ord_itm_idx
ON order_item(order_id item_id)));

Which statement is true regarding the above SOL statement?

A. It would execute successfully and only ORD_ITM_IDX index would be created.

B. It would give an error because the USING INDEX clause cannot be used on a composite
primary key.

C. It would execute successfully and two indexes ORD_ITM_IDX and ORD_ITM_ID_PK would be
created.

D. It would give an error because the USING INDEX clause is not permitted in the CREATE
TABLE command.
A
The WHERE clause is used to exclude rows before the grouping of data - Correct or Incorrect ?
Correct
Your Manager has asked you to display the Product_Name and List_Price from the table
where the Category_ID column has values 10 or 11, and the Supplier_ID column has the value 21894.

You execute the following SQL Statement:

SELECT Product_Name, List_Price
FROM PRODUCT_DETAILS
WHERE (Category_ID=10 OR Category_ID=11) AND Supplier_ID =21894;

Which of the following statements is true regarding the execution of the above query?

A: It would not execute because the entire WHERE clause condition is not enclosed
within the parenthesis.

B: It would generate an error message.

C: It would execute, and the output would display the desired result.

D: It would not execute because the same column has been used in both sides of the AND logical operator to form the condition
C: It would execute, and the output would display the desired result.
Is it possible for the main query to contain a greater than sign in its WHERE clause if the subquery returns only one value?
Yes
You issued this statement:

GRANT UPDATE
ON inventory
TO joe
WITH GRANT OPTION;

Which task was accomplished?

Only a system privilege was granted to user joe.

Only an object privilege was granted to user joe.

User joe was granted all privileges on the inventory object.

Both an object privilege and a system privilege were granted to user joe.
Only an object privilege was granted to user joe.
A multiple-column subquery can also be a scalar subquery - Correct or Incorrect about the Multiple column Subquery ?
Incorrect
ORDER__ID is the primary key in the ORDERS table. It is also the foreign key in the
ORDER_ITEMS table wherein it is created with the ON DELETE CASCADE option.

Which DELETE statement
would execute successfully?

A. DELETE order_id
FROM orders
WHERE order_total < 1000;

B. DELETE orders
WHERE order_total < 1000;

C. DELETE
FROM orders
WHERE (SELECT order_id
FROM order_items);

D. DELETE orders o, order_items i
WHERE o.order id = i.order id;
B
Which characters anchors the expression to the end of a line?
$
It works on the column list from right to left - Correct or Incorrect about ROLLUP operation ?
Correct
INTERVAL DAY TO SECOND -- stores a value of --
+06 03:30 18.000000'
Evaluate the following CREATE TABLE command:

CREATE TABLE order_item
(order_id NUMBER(3),
item_idNUMBER(2),
qtyNUMBER(4),
CONSTRAINT ord_itm_id_pk
PRIMARY KEY (order_id item_id)
USING INDEX
(CREATE INDEX ord_itm_idx
ON order_item(order_id,item_id)));

Which statement is true regarding the above SOL statement?

A. It would execute successfully and only ORD_ITM_IDX index would be created.

B. It would give an error because the USING INDEX clause cannot be used on a composite
primary key.

C. It would execute successfully and two indexes ORD_ITM_IDX and ORD_ITM_ID_PK would be
created.

D. It would give an error because the USING INDEX clause is not permitted in the CREATE
TABLE command.
A
Which is the maximum number of columns that can be defined in a view?
1000
What two keywords in a hierarchical query establishes the relationship between a parent and a child?
CONNECT BY
subquery must be enclosed in the parenthesis - True or False ?
1
A subquery can be used in the VALUES clause of an INSERT statement, if it returns more than one row - True or False regarding subquery ?
1
A B-tree index is used for columns with low cardinality - Correct or Incorrect about B-Tree Index ?
Incorrect
The TRUNC date function returns a date with the time portion of the day truncated to the specified format unit - True or False ?
1
The revoke command can be used to remove any privilege - Correct or Incorrect about Privileges ?
Correct
Which attributes indicates that the sequence continues to generate values after reaching either its maximum or minimum value?
CYCLE
GRANT emp, create table TO SCOTT; - Correct or Incorrect ?
Correct
A database object that is defined by a SELECT statement but contains no data is a:
VIEW
Which precedence orders represents the correct precedence of the operators?
+ (unary), - (unary), *, /,+, -, ||, =, !=, <, >, <=, >=, IS NULL, LIKE, BETWEEN,IN, NOT, AND, OR
Which statement do you use to remove previously granted privileges?
the REVOKE statement
A ______ value must either be null or match an existing value in the primary key column of the parent table.
foreign key
Subqueries cannot contain ORDER BY clause - Correct or Incorrect ?
Incorrect
Unique indexes are automatically created on columns that have which two types of constraints?
UNIQUE and PRIMARY KEY
Which DML statement updates rows conditionally, based on whether a row already exists or not?
the MERGE statement
What type of index would be most appropriate to use in a data warehousing application on a column where the cardinality may be poor?
a bitmap index
Indexes can be created in any tablespace - Correct or Incorrect about Indexes in Oracle ?
Correct
The REVOKE command can be used to remove privileges but not roles from other users - Correct or Incorrect about ROLES ?
Incorrect
DROP TABLE Order; CREATE TABLE Order; DROP TABLE Order; FLASHBACK TABLE Order TO BEFORE DROP; Which statements is true regarding the above Flashback operation?
It will recover only the second Order table
REGEXP_SUBSTR()
REGEXP_SUBSTR()

REGEXP_SUBSTR extends the functionality of the SUBSTR function by letting you search a string for a regular expression pattern. It is also similar to REGEXP_INSTR, but instead of returning the position of the substring, it returns the substring itself. This function is useful if you need the contents of a match string but not its position in
the source string. The function returns the string as VARCHAR2 or CLOB data in the same character set as source_char.

■ source_char is a character expression that serves as the search value. It is commonly a character column and can be of any of the data types CHAR,VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.

■ pattern is the regular expression. It is usually a text literal and can be of any of the data types CHAR, VARCHAR2, NCHAR, or NVARCHAR2. It can contain up to 512 bytes. If the data type of pattern is different from the data type of source_
char, then Oracle Database converts pattern to the data type of source_char.

■ position is a positive integer indicating the character of source_char where Oracle should begin the search. The default is 1, meaning that Oracle begins the search at the first character of source_char.

■ occurrence is a positive integer indicating which occurrence of pattern in source_char Oracle should search for. The default is 1, meaning that Oracle searches for the first occurrence of pattern.
If occurrence is greater than 1, then the database searches for the second occurrence beginning with the first character following the first occurrence of pattern, and so forth. This behavior is different from the SUBSTR function, which begins its search for the second occurrence at the second character of the first occurrence.

■ match_parameter is a text literal that lets you change the default matching behavior of the function. The behavior of this parameter is the same for this function as for REGEXP_COUNT.

■ For a pattern with subexpressions, subexpr is a nonnegative integer from 0 to 9 indicating which subexpression in pattern is to be returned by the function. This parameter has the same semantics that it has for the REGEXP_INSTR function.

The following example examines the string, looking for the first substring bounded by commas. Oracle Database searches for a comma followed by one or more occurrences of non-comma characters followed by a comma. Oracle returns the substring,
including the leading and trailing commas.

SELECT REGEXP_SUBSTR('500 Oracle Parkway, Redwood Shores, CA',
',[^,]+,') "REGEXPR_SUBSTR"
FROM DUAL;

REGEXPR_SUBSTR
-----------------
, Redwood Shores,

The following example examines the string, looking for http:// followed by a substring of one or more alphanumeric characters and optionally, a period (.). Oracle searches for a minimum of three and a maximum of four occurrences of this substring
between http:// and either a slash (/) or the end of the string.

SELECT REGEXP_SUBSTR('http://www.example.com/products',
'http://([[:alnum:]]+\.?){3,4}/?') "REGEXP_SUBSTR"
FROM DUAL;

REGEXP_SUBSTR
----------------------
http://www.example.com/
You work as a Database Developer for Biochem Inc. The company uses Oracle as its
database. You create a table named medicine that holds details of all available medicines. The Med_id column is the Primary key of the table.

Which of the following does the Primary key enforce?

A: Table integrity
B: Referential integrity
C: Column integrity
D: Row integrity
D: Row integrity
You want to calculate the remainder of the salary of all the Sales Representative, when their salaries are divided by 5000. Which of the following queries should you write to
accomplish the task?

A: SELECT Name, Salary, MOD (5000, salary)
FROM Emp_Info WHERE Code='SA REP';

B: SELECT Name, Salary, DIV (Salary, 5000)
FROM Emp_Info WHERE Code='SA REP';

C: SELECT Name, Salary FROM Emp_Info
WHERE Code='SA REP' AND Salary=Salary/5000;

D: SELECT Name, Salary, MOD (Salary, 5000)
FROM Emp_Info WHERE Code='SA REP';
D: SELECT Name, Salary, MOD (Salary, 5000)
FROM Emp_Info WHERE Code='SA REP';
You work as a Database Developer for Gadgets Inc. The company uses Oracle as its
database. The database contains a table named Employee. You want to retrieve the department id and the average salary from the Employee table. Along with the retrieval process, you also want to limit the display of average salary of only those departments that have an average salary greater than $80,000.

Which of the following queries will you fire to accomplish the task?

A: SELECT department_id, AVG(salary)
FROM employees
Having AVG(salary) > 80000
ORDER BY department_id;

B: SELECT department_id, AVG(salary)
FROM employees
GROUP BY department_id
Having AVG(salary) > 80000;

C: SELECT department_id, AVG(salary)
FROM employees
WHERE AVG(salary) > 80000
GROUP BY department_id;

D: SELECT department_id, AVG(salary)
FROM employees
WHERE AVG(salary) > 80000
ORDER BY department_id;
B: SELECT department_id, AVG(salary)
FROM employees
GROUP BY department_id
Having AVG(salary) > 80000;
Does the MERGE statement allow you to insert, update, and delete rows from a table?
Yes
TO_CHAR (datetime)
TO_CHAR (datetime)

TO_CHAR (datetime) converts a datetime or interval value of DATE, TIMESTAMP,
TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE, INTERVAL DAY
TO SECOND, or INTERVAL YEAR TO MONTH data type to a value of VARCHAR2 data type in the format specified by the date format fmt. If you omit fmt, then date is converted to a VARCHAR2 value as follows:

■ DATE values are converted to values in the default date format.
■ TIMESTAMP and TIMESTAMP WITH LOCAL TIME ZONE values are converted to values in the default timestamp format.
■ TIMESTAMP WITH TIME ZONE values are converted to values in the default timestamp with time zone format.
■ Interval values are converted to the numeric representation of the interval literal.

The 'nlsparam' argument specifies the language in which month and day names and abbreviations are returned. This argument can have this form:
'NLS_DATE_LANGUAGE = language'

If you omit 'nlsparam', then this function uses the default date language for your session.
A single WITH clause can contain only one query - Correct or Incorrect about the WITH clause ?
Incorrect
Which of the following views is used to increase request execution performance?

A: Default view
B: Inline view
C: Materialized view
D: Non-updatable view
C: Materialized view
Which metacharacters matches zero or one occurrence of the preceding subexpression?
?
Positional sorting is accomplished by specifying the numeric position of a column as it appears in the SELECT list, in the ORDER BY clause - Correct or Incorrect of ORDER BY clause ?
Correct
Which returns the path of a column value from root to node for each row returned by the CONNECT BY condition?
SYS_CONNECT_BY_PATH
You work as a Database Administrator for Bell Ceramics Inc. In order to avail the maximum benefit from the flash recovery area in Oracle 10g, you want to maximize its space. For this purpose you have to configure the initialization parameter / initialization parameters.

Which of the following parameter / parameters will you configure to accomplish the task?

A: DB_RECOVERY_FILE_DEST

B: Both DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE

C: Neither DB_RECOVERY_FILE_DEST nor DB_RECOVERY_FILE_DEST_SIZE

D: DB_RECOVERY_FILE_DEST_SIZE
D: DB_RECOVERY_FILE_DEST_SIZE
Evaluate this SQL statement:

SELECT line_item_id, order_id, product_id
FROM line_item

Which WHERE clause should you include to limit the query results to rows that have a QUANTITY column that has a null value?

WHERE quantity = NULL;
WHERE quantity <> NULL;
WHERE quantity != NULL;
WHERE quantity IS NULL;
WHERE quantity IS NULL;
Which should you specify to re-create the view if it already exists?
OR REPLACE
Which clauses is used to prune a branch from a hierarchy tree?
CONNECT BY
When joining more than two tables using an ON clause, in which order are the joins evaluated?
from left to right
The NVL2 function accepts three expressions, and returns the second expression if the first expression is ______.
NOT NULL. If the first expression is null, the third expression is returned
A sub query in the WHERE clause of a SELECT statement can be nested up to three levels only - True or False ?
1
What value is returned after executing the following statement? SELECT MOD(14,3) FROM DUAL;
2
Oracle has object privileges that allow grants to specific tables - Correct or Incorrect about Privileges ?
Correct
A subquery used in a complex view definition cannot contain group functions or joins - Correct or Incorrect about VIEWS ?
Incorrect
David created a few database objects in his schema. Now, Samantha wants to restrict David from accessing the database. She also wants to ensure that the objects owned by David remain intact in the database. What will she do to accomplish this?
Revoke the CREATE SESSION privilege from David's user account / Lock David's user account
The ORDER BY clause can be included in a SELECT with set operators if:
It follows the final SELECT statement
A sub query that is used in a complex view definition cannot contain joins or group functions - Correct or Incorrect about a VIEW ?
Incorrect
Which datatype is an extension of the DATE datatype and stores a fractional second value?
TIMESTAMP
DECODE()
DECODE compares expr to each search value one by one. If expr is equal to a search, then Oracle Database returns the corresponding result. If no match is found, then Oracle returns default. If default is omitted, then Oracle returns null.

The arguments can be any of the numeric types (NUMBER, BINARY_FLOAT, or BINARY_DOUBLE) or character types.

■ If expr and search are character data, then Oracle compares them using nonpadded comparison semantics. expr, search, and result can be any of the data types CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The string returned is of
VARCHAR2 data type and is in the same Character set as the first result parameter.
■ If the first search-result pair are numeric, then Oracle compares all search-result expressions and the first expr to determine the argument with
the highest numeric precedence, implicitly converts the remaining arguments to that data type, and returns that data type.

The search, result, and default values can be derived from expressions. Oracle
Database uses short-circuit evaluation. The database evaluates each search value only before comparing it to expr, rather than evaluating all search values before comparing any of them with expr. Consequently, Oracle never evaluates a search if a previous search is equal to expr.

Oracle automatically converts expr and each search value to the data type of the first search value before comparing. Oracle automatically converts the return value to the same data type as the first result. If the first result has the data type CHAR or if the first result is null, then Oracle converts the return value to the data type
VARCHAR2.

In a DECODE function, Oracle considers two nulls to be equivalent. If expr is null, then Oracle returns the result of the first search that is also null.

The maximum number of components in the DECODE function, including expr,searches, results, and default, is 255.
Which operators can be used with a subquery?
NOT IN, IN, EXISTS
Valid table and column names can only contain which characters?
the characters A-Z, a-z, 0-9, _ (underscore), $, and #.
Which clause of a SELECT statement specifies the name of the table or tables being queried?
the FROM clause
What constraint(s) is used to create referential integrity?
the REFERENCES constraint or the FOREIGN KEY constraint
Which is the default Flashback TRANSACTION_BACKOUT option?
NOCASCADE
The size of the primary key cannot exceed approximately one database block - Correct or Incorrect about Primary Key Constraint ?
Correct
Which clause of a MERGE statement modifies existing records?
the UPDATE clause
The products table has hierarchical data, which is queried using a hierarchical query. The steps of execution of the hierarchical query are given below in random order (numbering does not correspond to correct order):

1. The START WITH condition is evaluated.
2. The CONNECT BY condition is evaluated.
3. Joins in the query are evaluated.

Which of the following options indicate the CORRECT order of steps?

1, 2, 3
2, 1, 3
3, 1, 2
3, 2, 1
3, 2, 1
Evaluate the following SQL statement that is based on the EMPLOYEES and SALES
table:

SQL > SELECT e.EMP_ID, e.FIRST_NAME, s.QUANTITY_SOLD
FROM SALES s
RIGHT OUTER JOIN EMPLOYEES e
ON (e.PROD_ID = s.PROD_ID);

Which statement is correct regarding the result/output of the above query?

A: The query will give details of employees who have sold maximum quantity of a
particular product.

B: The query will give details of employees who have not sold any product.

C: The query will give details of all the products sold irrespective of whether or not
they have been done by any employee.

D: The query will give details of all the employees irrespective of whether or not they have sold any product.
D: The query will give details of all the employees irrespective of whether or not they have sold any product
Given below are the SQL statements executed in a user session:

CREATE TABLE product
(pcode NUMBER(2),
pnameVARCHAR2(10));

INSERT INTO product VALUES(1, 'pen');

INSERT INTO product VALUES (2,'penci');

SAVEPOINT a;

UPDATE product SET pcode = 10 WHERE pcode = 1;

SAVEPOINT b;

DELETE FROM product WHERE pcode = 2;

COMMIT;

DELETE FROM product WHERE pcode=10;

ROLLBACK TO SAVEPOINT a;

Which statement describes the consequences?

A. No SQL statement would be rolled back.

B. Both the DELETE statements would be rolled back.

C. Only the second DELETE statement would be rolled back.

D. Both the DELETE statements and the UPDATE statement would be rolled back.
A
REPLACE()
REPLACE()

REPLACE returns char with every occurrence of search_string replaced with replacement_string. If replacement_string is omitted or null, then all
occurrences of search_string are removed. If search_string is null, then char is returned.

Both search_string and replacement_string, as well as char, can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The string returned is in the same character set as char. The function returns VARCHAR2 if the first argument is not a LOB and returns CLOB if the first argument is a LOB.

REPLACE provides functionality related to that provided by the TRANSLATE function.

TRANSLATE provides single-character, one-to-one substitution. REPLACE lets you
substitute one string for another as well as to remove character strings.

The following example replaces occurrences of J with BL:

SELECT REPLACE('JACK and JUE','J','BL') "Changes" FROM DUAL;

Changes
--------------
BLACK and BLUE
If the subquery returns more than one row, then Oracle returns an error - Correct or Incorrect about Scaler Subquery ?
Correct
View the Exhibit and examine the details of the EMPLOYEES table.

You want to generate a hierarchical report for all the employees who report to the employee
whose EMPLOYEE_ID is 100.

Which SQL clauses would you require to accomplish the task? (Choose all that apply.)

A. WHERE
B. HAVING
C. GROUP BY
D. START WITH
E. CONNECT BY
A,D,E
Which one of the regular expression functions returns the substring value that matches a given pattern in a given string?
REGEXP_SUBSTR
SELECT line_item_id, order_id, product_id FROM line_item; Which WHERE clause should you include to limit the query results to rows that have a QUANTITY column that has a null value?
WHERE quantity IS NULL;
You are maintaining the database for an online travel company. The database contains data about local and international destinations in the local and intl tables, respectively. The top5 table in the database contains data about the five most visited local and international destinations.

Which of the following Oracle queries should you execute to display a list of the most visited international destinations?

SELECT * FROM top5;

SELECT * FROM intl;

SELECT * FROM top5
INTERSECT
SELECT * FROM intl;

SELECT * FROM top5
MINUS
SELECT * FROM intl;
SELECT * FROM top5
INTERSECT
SELECT * FROM intl;
Which operator would immediately precede a subquery if that subquery can potentially return more than one row?
IN
View the Exhibit and examine the structure of the
PRODUCTINFORMATION and INVENTORIES tables
.
You want to display the quantity on hand for all the products available in the RODUCTINFORMATION table that have the PRODUCT_STATUS as 'orderable' QUANTITY_ON_HAND is a column in the INVENTORIES table.

The following SQL statement was written to accomplish the task:

SELECT pi. Product_id, pi.product_status, sum(i.quantity_on_hand) FROM product_information pi LEFT OUTER JOIN inventories i ON (pi. Product_id = i. product_id)
WHERE (pi.product_status = 'orderable")
GROUP BY pi.product_id, pi.product_status;

Which statement is true regarding the execution of this SQL statement?

A. The statement would execute and produce the desired output.

B. The statement would not execute because the WHERE clause is used before the GROUP BY
clause.

C. The statement would not execute because prefixing table alias to column names is not allowed with the ON clause.

D. The statement would not execute because the WHERE clause is not allowed with LEFT
OUTER JOIN.

E. The statement would not execute because the WHERE clause is not allowed with LEFT OUTER
JOIN.
D
One user can acquire the sequence number generated by another user - Correct or Incorrect about Sequences ?
Incorrect
Which clause in a hierarchical query specifies the root row of the hierarchy?
START WITH
What will be the result of executing the following SQL statement?

SELECT NULLIF('01-Aug-2008','01-Aug-08') FROM DUAL;

A: NULL
B: An ORA error
C: 01-Aug-2008
D: 01-Aug-08
C: 01-Aug-2008
If the same column name appears in more than one table in a join condition, by what must the column name be prefixed?
by the table name or a table alias
Which is the simplest extension of the GROUP BY clause?
ROLLUP
A sub query can be used to access data from one or more tables or views - True or False ?
1
Single Row Functions may return more than one result - True or False ?
1
What should a user use to allow transparent access to other database on other nodes or even other entire systems halfway around the globe?
DATABASE LINKS
What will be the result of using the SUBSTR function if the start position is larger than the length of the source string?
NULL
Which system privileges should a user have to create a relational table in his own schema?
CREATE TABLE
Which comparison operators can be used with multiple-row subqueries?
IN, ANY, and ALL
The WITH CHECK OPTION constraint can be used in a view definition to restrict the columns displayed through the view - Correct or Incorrect about a VIEW ?
Incorrect
CHARTOROWID()
CHARTOROWID converts a value from CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type to ROWID data type

This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion.
The EXISTS condition can also be combined with the NOT operator - Correct or Incorrect ?
Correct
What are distinguishing characteristics of a public synonym rather than a private synonym?
Public synonyms can be accessed by name without a schema name qualifier. / Public synonyms can have the same names as tables or views
Which of the following functions returns the first non-null expr in the expression list?
COALESCE
A constraint is enforced only for the INSERT operation on a table - True or False ?
1
Which of the following are schema objects? - SEQUENCE, PASSWORD, INDEX, ROLE
SEQUENCE, INDEX
What are the first two words in the command used to disable a constraint on the column called id on the emp table?
ALTER TABLE
Which data dictionary views contains comments on columns of all tables and views?
DBA_COL_COMMENTS
What is the name of the concept that guarantees that users have a consistent view of the data?
read consistency
Which conditions signify that you should not create an index on a table's column?
If the table is updated frequently / If the table is small in size
Which of the following statements are true about external tables in Oracle?

Each correct answer represents a complete solution. Choose all that apply.

A: They can be used in joins, views, and subqueries.

B: They can have indexes, constraints, or, triggers.

C: They cannot be written to with DML commands.

D: They cannot be queried in a similar manner as internal tables.
A: They can be used in joins, views, and subqueries

C: They cannot be written to with DML commands
TO_TIMESTAMP_TZ()
TO_TIMESTAMP_TZ()

TO_TIMESTAMP_TZ converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data
type to a value of TIMESTAMP WITH TIME ZONE data type.

This function does not convert character strings to TIMESTAMP WITH LOCAL TIME ZONE. To do this, use a CAST function

The optional fmt specifies the format of char. If you omit fmt, then char must be in the default format of the TIMESTAMP WITH TIME ZONE data type. The optional 'nlsparam' has the same purpose in this function as in the TO_CHAR function for date conversion.
Consider the exhibit given below:

SQL> DESC EMP

Name Null? Type
------------------- ------------------- -------------------
EMPID NUMBER
SAL NUMBER
HIREDATE DATE

Which of the following queries would provide all the details (EMPID, SAL and HIREDATE) about the oldest employee in the company?

A: SELECT * FROM EMP WHERE HIREDATE =
(SELECT MIN (HIREDATE) FROM EMP);

B: SELECT MAX (HIREDATE) FROM EMP;

C: SELECT * FROM EMP WHERE HIREDATE =
(SELECT MAX (HIREDATE) FROM EMP);

D: SELECT MIN (HIREDATE) FROM EMP;
A: SELECT * FROM EMP WHERE HIREDATE =
(SELECT MIN (HIREDATE) FROM EMP);
You need to define a regular expression pattern that accepts any one of the string literal values of DC, VA, or MD. Which patterns will do this?
'(DC|VA|MD)'
Evaluate the following SQL statement:

SELECT oi.order_id, product_id, order_date FROM order_items oi JOIN orders o
USING(order_id);

Which statement is true regarding the execution of this SQL statement?

A. The statement would not execute because table aliases are not allowed in the JOIN clause.

B. The statement would not execute because the table alias prefix is not used in the USING clause.

C. The statement would not execute because all the columns in the SELECT clause are not prefixed with table aliases.

D. The statement would not execute because the column part of the USING clause cannot have a qualifier in the SELECT list.
D
ORDER BY can be used in the UPDATE statement as well as SELECT and DELETE - Correct or Incorrect of ORDER BY clause ?
Incorrect
View the Exhibit and examine the details for the CATEGORIES_TAB table.

Evaluate the following incomplete SQL statement:

SELECT category_name ,category_description FROM categories_tab

You want to display only the rows that have 'harddisks' as part of the string in the
CATEGORY_DESCRIPTION column.

Which two WHERE clause options can give you the desired result? (Choose two.)

A. WHERE REGEXPJJKE (category_description, 'hard+.s');

B. WHERE REGEXPJJKE (category_description, '^H|hard+.s');

C. WHERE REGEXPJJKE (category_description, '^H|hard+.s$');

D. WHERE REGEXPJJKE (category_description, '[^Hlhard+.s]');
A,B
Which are the two types of multitable inserts?
INSERT FIRST and INSERT ALL
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its
database. The database contains a table named Employees. You want to retrieve the first name and address of those employees who earn a salary of USD1000. The Emp_salary column is of NUMBER(8,2) data type.

Which of the following SQL statements will you use to accomplish the task?

Each correct answer represents a complete solution. Choose two.

A: SELECT Emp_first_name, Emp_add FROM Employees WHERE Emp_salary = "USD1000";

B: SELECT Emp_first_name, Emp_add FROM Employees WHERE Emp_salary ='1000';

C: SELECT Emp_first_name, Emp_add FROM Employees WHERE Emp_salary = "1000";

D: SELECT Emp_first_name, Emp_add FROM Employees WHERE Emp_salary = 1000
B: SELECT Emp_first_name, Emp_add FROM Employees WHERE Emp_salary ='1000';

D: SELECT Emp_first_name, Emp_add FROM Employees WHERE Emp_salary = 1000;
It enables users to store the result of a query permanently - Correct or Incorrect regarding the benefits of using the WITH clause ?
Incorrect
The ORDER BY or GROUP BY clause can be specified in a hierarchical query - Correct or Incorrect about Hierarchial Retrieval ?
Incorrect
Linda is the database administrator for a public library. She needs to display the total number of books including copies for:

z Every type of book
z Every author
z Every type of book by every author

Which of the following queries should you use to achieve the given data?

SELECT COUNT(*) AS Number, SUM(copies) AS TotalCopies FROM books GROUP BY author, book_type;

SELECT COUNT(*) AS Number, SUM(copies) AS TotalCopies FROM books GROUP BY ROLLUP(author, book_type);

SELECT COUNT(*) AS Number, SUM(copies) AS TotalCopies FROM books GROUP BY CUBE(author, book_type);

SELECT COUNT(*) AS Number, SUM(copies) AS TotalCopies FROM books GROUP BY GROUPING SETS(author, book_type);
SELECT COUNT(*) AS Number, SUM(copies) AS TotalCopies FROM books GROUP BY CUBE(author, book_type);
It is used to specify the concatenated group expressions to be used for calculating the grand totals and subtotals - Correct or Incorrect about GROUPING function ?
Incorrect
Which will the Grouping() return when the column value is null?
1
JOIN is based on the relationship between the two tables - Correct or Incorrect about JOINING the tables ?
Correct
What value is returned after executing the following statement: SELECT SUBSTR('How_long_is_a_piece_of_string?', 5,4) FROM DUAL;
long
Which functions works in the same way as the CASE expression?
DECODE()
You want to create a simple database view on which other privileged users should not be able to perform DML operations. Which options will you choose?
Create the view with the WITH READ ONLY option / Create the view as a Complex View. / Grant only SELECT access on the view to users
EMPTY_BLOB(), EMPTY_CLOB()
EMPTY_BLOB and EMPTY_CLOB return an empty LOB locator that can be used to initialize a LOB variable or, in an INSERT or UPDATE statement, to initialize a LOB column or attribute to EMPTY. EMPTY means that the LOB is initialized, but not populated with data.

An empty LOB is not the same as a null LOB, and an empty CLOB is not the same as a LOB containing a string of 0 length.

Restriction on LOB Locators You cannot use the locator returned from this function as a parameter to the DBMS_LOB package or the OCI.

The following example initializes the ad_photo column of the sample pm.print_media table to EMPTY:

UPDATE print_media
SET ad_photo = EMPTY_BLOB();
A private synonym:
Can be seen by any user in the database who has privileges on it and has privileges on the synonym’s underlying object.
A TIMESTAMP data type column stores only time values with fractional seconds - True or False about Oracle Data Types ?
1
Which condition would allow a user to grant SELECT privileges on the CUSTOMER table to everyone using the PUBLIC keyword?
The user owns the CUSTOMER table.
Which of the following should you specify to indicate that the table is temporary and that its definition is visible to all sessions with appropriate privileges?
GLOBAL TEMPORARY
Index - Is it a Database Object ? - yes or No
yes
Constraints prevent rows with dependencies from being deleted - Correct or Incorrect about Constraints ?
Correct
It is not possible to specify NULL or NOT NULL for an attribute of an object - Correct or Incorrect about NOT NULL constraint ?
Correct
Which option of the ROLLBACK statement should you include to roll back only the changes after a particular savepoint?
TO SAVEPOINT. The syntax is ROLLBACK TO SAVEPOINT name;
An external table does not describe any data that is stored in the database - Correct or Incorrect about EXTERNAL tables ?
Correct
If an UPDATE or DELETE command has a WHERE clause that gives it a scope of several rows, what will happen if there is an error part way through execution? The command is one of several in a multistatement transaction.
Whatever work the command had done before hitting the error will be rolled back, but work done already by the transaction will remain.
RANK()
RANK()

RANK calculates the rank of a value in a group of values. The return type is NUMBER.

Rows with equal values for the ranking criteria receive the same rank. Oracle Database then adds the number of tied rows to the tied rank to calculate the next rank.

Therefore, the ranks may not be consecutive numbers. This function is useful for top-N and bottom-N reporting.

■ As an aggregate function, RANK calculates the rank of a hypothetical row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row within each group. The constant argument expressions and the expressions in the
ORDER BY clause of the aggregate match by position. Therefore, the number of arguments must be the same and their types must be compatible.
Which of the following are NOT the correct ways of using group functions in Oracle?

Here, the group functions are represented by the letter G.

Each correct answer represents a complete solution. Choose two.

A: G1(G2(G3(group_item))) = result
B: G1(G2(group_item)) = result
C: G1(group_item) = result
D: G1(G2(G3(G4(group_item)))) = result
A: G1(G2(G3(group_item))) = result

D: G1(G2(G3(G4(group_item)))) = result
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its
database. The database contains a table named Employee. You issue the DESC(RIBE)
employee command to see the details of the table, which are as follows:

emp_id emp_f_name emp_l_name emp_hire_date emp_contact

Which of the following SQL statements will insert a row in the table?

Each correct answer represents a complete solution. Choose two.

A: INSERT INTO employee (emp_id, emp_f_name, emp_l_name, emp_contact,
emp_hire_date) VALUES (7, 'John', 'Greg', '800-555-1216', '01-JAN-1975');

B: INSERT INTO employee
VALUES (7, 'John', 'Greg', '800-555-1216', '01-JAN-1975');

C: INSERT INTO employee
VALUES (7, 'John', 'Greg', '01-JAN-1975', '800-555-1216');

D: INSERT INTO employee (emp_id, emp_f_name, emp_l_name, emp_contact,
emp_hire_date) VALUE (7, 'John', 'Greg', '01-JAN-1975', '800-555-1216');
A: INSERT INTO employee (emp_id, emp_f_name, emp_l_name, emp_contact,emp_hire_date)
VALUES (7, 'John', 'Greg', '800-555-1216', '01-JAN-1975');

C: INSERT INTO employee
VALUES (7, 'John', 'Greg', '01-JAN-1975', '800-555-1216');
What are the four group functions that can only be used with numeric datatypes?
SUM, AVG, VARIANCE, and STDDEV
Using the FLASHBACK feature of Oracle, which of the following options will retrieve data from the EMP table for a particular time without actually doing a restore of the EMP table?

Each correct answer represents a complete solution. Choose all that apply.

A: DBMS_FLASHBACK.ENABLE_AT_TIME (<timestamp>);
SELECT * FROM EMP;

B: SELECT * FROM EMP AS OF TIMESTAMP <timestamp>;

C: FLASHBACK TABLE EMP TO TIMESTAMP <timestamp>;

D: FLASHBACK DATABASE TO TIMESTAMP <timestamp>;
A: DBMS_FLASHBACK.ENABLE_AT_TIME (<timestamp>);
SELECT * FROM EMP;

B: SELECT * FROM EMP AS OF TIMESTAMP <timestamp>;
The subquery of the multitable insert statement cannot use a sequence - Correct or Incorrect ?
Correct
Given below is a list of functions and the tasks performed by using these functions, in
random order:

S.No Function
Name
1 LPAD
2 TRUNC
3 DECODE
4 TRIM
5 INSTR
6 COUNT

Task Performed
---------------------
a) Used to truncate a column, expression, or value to n decimal places.
b) Used to remove heading or trailing or both
characters from the character string.
c) Pads the character value right-justified to a total
width of n character positions.
d) Used to return the numeric value for position of a named character from the character string.
e) Used to translate an expression after comparing it with each search value.
f) Used to count the number of records present in a column of a table.

Which of the following options correctly matches the function name with their usage?

A: 1-a, 2-d, 3-c, 4-b, 5-e, 6-f
B: 1-e, 2-d, 3-c, 4-b, 5-a, 6-f
C: 1-c, 2-a, 3-e, 4-b, 5-d, 6-f
D: 1-c, 2-e, 3-b, 4-d, 5-a, 6-f
C: 1-c, 2-a, 3-e, 4-b, 5-d, 6-f
In multiple-column subqueries, rows in the subquery results are evaluated in the main query in pair-wise comparison - Correct or Incorrect about Multiple Column Subquery ?
Correct
At least one join condition is present in most of the join queries.

In which of the following clauses can this join condition be placed?

Each correct answer represents a complete solution. Choose all that apply.

A: ORDER BY
B: GROUP BY
C: WHERE
D: FROM
C: WHERE
D: FROM
An aggregate function can be called from:
The ORDER BY clause of a SELECT statement / The select list of a SELECT statement
Which SELECT statement clause creates an equijoin by specifying a column name common to both tables?
a USING clause
The GROUP BY clause is mandatory if a user is using an aggregate function in the SELECT clause - Correct or Incorrect ?
Incorrect
Examine the structures of the customer and curr_order tables:

customer
--------------------
customer_id NUMBER(5)
name VARCHAR2(25)
credit_limit NUMBER(8,2)
acct_open_date DATE

curr_order
-------------------------
order_id NUMBER(5)
customer_id NUMBER(5)
order_date DATE
total NUMBER(8,2)

Which scenario would require a subquery to return the desired results?

You need to display the names of all the customers who placed an order today.

You need to determine the number of orders placed this year by the customer with customer_id value 30450.

You need to determine the average credit limit of all the customers who opened an account this year.

You need to determine which customers have placed orders with amount totals larger than the average order amount.
You need to determine which customers have placed orders with amount totals larger than the average order amount.
Which is an extension of the GROUP BY clause?
CUBE clause
The UNION operator cannot be used for more than two tables - Correct or Incorrect ?
Incorrect
Which user owns the Data dictionary base tables?
The SYS database user
Which character function returns a portion of a character string, beginning at a specified character position up to a specified length?
SUBSTR. The syntax of the SUBSTR function is SUBSTR(column|expression, m [, n])
SELECT MOD('13',2) FROM DUAL; - Correct or Incorrect ?
Correct
DECOMPOSE()
DECOMPOSE is valid only for Unicode characters. DECOMPOSE takes as its argument a
string in any data type and returns a Unicode string after decomposition in the same character set as the input.


■ string can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2,CLOB, or NCLOB.

CLOB and NCLOB values are supported through implicit conversion. If char is a character LOB value, then it is converted to a VARCHAR value before the COMPOSE operation. The operation will fail if the size of the LOB value exceeds the supported length of the VARCHAR in the particular development environment.
CREATE PUBLIC SYNONYM part FOR linda.product; Which task was accomplished by this statement?
The need to qualify an object name with its schema was eliminated.
In which situation(s) would you be able to revoke the SELECT privilege on the CUSTOMER table from user Kate?
You have SYSDBA privileges. / You are the user that granted user Kate the SELECT privilege on the CUSTOMER table
Which keyword when used in a SELECT clause returns only the unique values or combination of values for the column(s) that follow?
DISTINCT
What does the IDENTIFIED BY clause of the ALTER USER statement specify?
the assignment of a password for the user
Constraints can be created at the time of table creation - True or False ?
1
You must provide a name for each constraint at the time of its creation - Correct or Incorrect about Constraints ?
Incorrect
SELECT MOD('13.3',2) FROM DUAL; - Correct or Incorrect ?
Correct
Which category of SQL statement includes the INSERT, UPDATE, DELETE, and MERGE statements?
DML
Constraint names are not required to follow the standard object-naming rules - Correct or Incorrect about Constraints ?
Correct
Conditions of check constraints can contain the subqueries and scalar subquery expressions - Correct or Incorrect about CHECK constraints ?
Incorrect
Which two statements would cause an implicit COMMIT to occur?
GRANT / RENAME
Which data dictionary view would you query to display the SELECT privileges granted on columns of tables that you own?
ALL_COL_PRIVS_MADE
You work as a Database Expert for Gigabytes Inc. The company uses Oracle as its database. The database contains a table named Employee.

You issue the following subquery against the Employee table:

SELECT employee_id, last_name
FROM employee
WHERE salary = (SELECT MIN (salary)
FROM employee
GROUP BY department_id);

When the subquery is executed, it generates an error message.

Which of the following is the reason for the error?

A: The MIN function is improperly used.

B: A single row subquery returns more than one row.

C: The GROUP BY function cannot be used in an inner query.

D: The WHERE clause cannot be used in a subquery.
B: A single row subquery returns more than one row.
Which of the following SQL statements will generate an ORA error?

A: SELECT NVL(SUBSTR('abc',4), 'No such substring found') FROM DUAL;

B: SELECT NVL(1234) FROM DUAL;

C: SELECT NVL(INSTR('1#2#3#4#5#','#',11), 'The # symbol not found') FROM DUAL;

D: SELECT NVL(null,1234) FROM DUAL;
B: SELECT NVL(1234) FROM DUAL;
You want to delete any products supplied by suppliers located in Dallas that have an in-stock quantity less than a specified value.

Which statement should you use?

DELETE FROM product
WHERE supplier_id =
(SELECT supplier_id
FROM supplier
WHERE UPPER(city) = 'DALLAS')
AND qty_in_stock < &qoh;

DELETE FROM product
WHERE supplier_id IN
(SELECT supplier_id
FROM supplier
WHERE UPPER(city) = 'DALLAS'
AND qty_in_stock < &qoh);

DELETE FROM supplier
WHERE supplier_id IN
(SELECT supplier_id
FROM supplier
WHERE UPPER(city) = 'DALLAS')
AND qty_in_stock < &qoh;

DELETE FROM product
WHERE supplier_id IN
(SELECT supplier_id
FROM supplier
WHERE UPPER(city) = 'DALLAS')
AND qty_in_stock < &qoh;

DELETE FROM product
WHERE supplier_id IN
(SELECT supplier_id
FROM supplier
WHERE UPPER(city) = 'DALLAS'
AND supplier_id IN
(SELECT supplier_id
FROM product
WHERE qty_in_stock > &qoh));
DELETE FROM product
WHERE supplier_id IN
(SELECT supplier_id
FROM supplier
WHERE UPPER(city) = 'DALLAS')
AND qty_in_stock < &qoh;
What is the name of the pseudocolumn which indicates the DML performed on a row?
versions_operation
If you want to sort the final result set where SET operators are being used, what considerations need to taken care of for the query to work?

Each correct answer represents a complete solution. Choose all that apply.

A: The ORDER BY clause should use column names from the first component query.

B: Place the ORDER BY clause at the end of the entire statement.

C: Component queries can't have their own ORDER BY clauses.

D: The ORDER BY clause can appear only once.
A: The ORDER BY clause should use column names from the first component query.

B: Place the ORDER BY clause at the end of the entire statement.

C: Component queries can't have their own ORDER BY clauses.

D: The ORDER BY clause can appear only once.
For which of the following purposes you cannot use scalar subqueries?
GROUP BY and HAVING clauses, WHEN condition of triggers, START WITH and CONNECT BY clauses, CHECK constraints on columns
Which of the following options should you use to insert data into the Name column only of the T1 table?

SQL> DESC T1

Name Null? Type
------------- ------------- -------------
CUST_NBR NUMBER(5)
NAME VARCHAR2(30)

Each correct answer represents a complete solution. Choose all that apply

A: INSERT INTO T1 VALUES('ADAM KINGER',NULL);

B: INSERT INTO T1 VALUES(NULL,'ADAM KINGER');

C: INSERT INTO T1(NAME) VALUES('ADAM KINGER');

D: INSERT INTO T1 VALUES(NULL);
B: INSERT INTO T1 VALUES(NULL,'ADAM KINGER');
C: INSERT INTO T1(NAME) VALUES('ADAM KINGER');
Correct syntax for using the HAVING clause?
SELECT (column_name) FROM (entity_name) GROUP BY (column_name) HAVING (function condition);
Aggregate functions:
Return one value for each group of rows specified in a SELECT statement / Are also called group functions
EMP is a table with all the details of employees and EMP_TERM is a new table with
employee number and name of the employees that have been terminated from the company.

Which of the following options are the alternative ways to write the following SQL query?

SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE, A.SAL, A.MGR, A.DEPTNO
FROM EMP A
WHERE (A.EMPNO, A.ENAME) IN (SELECT B.EMPNO, B.ENAME FROM EMP_TERM B);

Each correct answer represents a complete solution. Choose two.

A: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE,A.SAL, A.MGR, A.DEPTNO
FROM EMP A
WHERE (A.ENAME, A.EMPNO) IN (SELECT B.EMPNO, B.ENAME FROM EMP_TERM B);

B: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE,A.SAL, A.MGR, A.DEPTNO
FROM EMP A
WHERE (A.EMPNO, A.ENAME) IN (SELECT * FROM EMP_TERM B);

C: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE,A.SAL, A.MGR, A.DEPTNO
FROM EMP A
WHERE A.EMPNO = (SELECT B.EMPNO FROM EMP_TERM B)
AND A.ENAME = (SELECT C.ENAME FROM EMP_TERM C);

D: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE,A.SAL, A.MGR, A.DEPTNO
FROM EMP A
WHERE A.EMPNO IN (SELECT B.EMPNO FROM EMP_TERM B)
AND A.ENAME IN (SELECT C.ENAME FROM EMP_TERM C);
B: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE,
A.SAL, A.MGR, A.DEPTNO
FROM EMP A
WHERE (A.EMPNO, A.ENAME) IN (SELECT * FROM EMP_TERM B);

D: SELECT A.EMPNO, A.ENAME, A.JOB, A.HIREDATE,
A.SAL, A.MGR, A.DEPTNO
FROM EMP A
WHERE A.EMPNO IN (SELECT B.EMPNO FROM EMP_TERM B)
AND A.ENAME IN (SELECT C.ENAME FROM EMP_TERM C);
The ROLLUP operation can be used with:
Any aggregate function
In orders are the conditions in an INSERT FIRST statement evaluated?
Top to bottom
View the Exhibit and examine the description of the EMPLOYEES table.

Evaluate the following SQL statement:

SELECT employee_id, last_name, job_id, manager_id, LEVEL FROM employees
START WITH employee_id = 101
CONNECT BY PRIOR employee_id=manager_id ;

Which two statements are true regarding the output of this command? (Choose two.)

A. The output would be in top-down hierarchy starting with EMPLOYEE_ID having value 101.

B. The output would be in bottom-up hierarchy starting with EMPLOYEE_ID having value 101.

C. The LEVEL column displays the number of employees in the hierarchy under the employee
having the EMPLOYEE_ID 101.

D. The LEVEL column displays the level in the hierarchy at which the employee is placed under
the employee having the EMPLOYEE_ID 101
B,C
You cannot use the (+) operator to outer-join a table to itself, although self joins are valid - Correct or Incorrect about using Oracle Join Operator ( + ) ?
Correct
Which tasks can be performed with the help of dynamic performance view?
To see who is on the system / To see what SQL users are running on the system / To see what waits are occurring in your database / To see what session is blocking other session
Which type of join joins two tables by all columns that have the same name in both tables?
a natural join
Which function returns the first non-null expression in a list?
the COALESCE function
SELECT MOD('13.3.3',2) FROM DUAL; - Correct or Incorrect ?
Incorrect
When a database instance shuts down abnormally, the sequence numbers that have been cached but not used would be available once again when the database instance is restarted - Correct or Incorrect about Sequences created in a single instance database ?
Incorrect
Which is the system privilege that empowers the grantee to create an index in his or her own user account—but not in the accounts of others?
CREATE TABLE
A role can be granted to itself - Correct or Incorrect about ROLES ?
Incorrect
Constraints can be defined at the column or the row level - True or False ?
1
Which data dictionary view should a user query to see what privileges are available and what roles are enabled in his/her session?
SESSION_PRIVS / SESSION_ROLES
REGEXP_INSTR (Address, '[^[:alpha:]]') = 1; - Output of the Expression -
It would display all the addresses where the first character is not a letter of the alphabet.
What is the difference between the MOD and REMAINDER functions?
MOD uses the FLOOR function and REMAINDER uses the ROUND function
You cannot define a NOT NULL column if the column does not have a non-null value for every row - Correct or Incorrect about NOT NULL constraints ?
Correct
ALTER TABLE products DROP COLUMN discount; - Correct or Incorrect ?
Correct
Which capabilities refers to the restriction of tables or rows from a table?
Selection
Which commands will remove every row in a table?
A DELETE command with no WHERE clause / A TRUNCATE command
You are tasked with the job of adding a comment to the data dictionary to accompany the column PIER in the table MARINA. Which will execute successfully?
COMMENT ON COLUMN MARINA.PIER IS ‘Number of piers’;
Which is the correct syntax of inserting rows in a table?
INSERT INTO (column1, column2,...columnN) VALUES (value1,value2,...valueN);
Which of the following SQL queries will generate an output of 5#6#7#8#9#?

Each correct answer represents a complete solution. Choose two.

A: SELECT SUBSTR('1#2#3#4#5#6#7#8#9#',9,10) FROM DUAL;

B: SELECT INSTR('1#2#3#4#5#6#7#8#9#',5,8) FROM DUAL;

C: SELECT SUBSTR('1#2#3#4#5#6#7#8#9#',9) FROM DUAL;

D: SELECT INSTR('1#2#3#4#5#6#7#8#9#',5,12) FROM DUAL;
A: SELECT SUBSTR('1#2#3#4#5#6#7#8#9#',9,10) FROM DUAL;

C: SELECT SUBSTR('1#2#3#4#5#6#7#8#9#',9) FROM DUAL
Evaluate the following query:

SELECT INTERVAL 300' MONTH,
INTERVAL 54-2' YEAR TO MONTH,
INTERVAL '11:12:10.1234567' HOUR TO SECOND
FROM dual;

What is the correct output of the above query?

A. +25-00, +54-02, +00 11:12:10.123457

B. +00-300, +54-02, +00 11:12:10.123457

C. +25-00, +00-650, +00 11:12:10.123457

D. +00-300, +00-650, +00 11:12:10.123457
A
You executed the following SQL statements in the given order:

CREATE TABLE orders
(order_id NUMBER(3) PRIMARY KEY,
order_date DATE,
customer_idnumber(3));

INSERT INTO orders VALUES (100,'10-mar-2007,,222);

ALTER TABLE orders MODIFY order_date NOT NULL;

UPDATE orders SET customer_id=333;
DELETE FROM order;

The DELETE statement results in the following error:

ERROR at line 1:
ORA-00942: table or view does not exist

What would be the outcome?

A. All the statements before the DELETE statement would be rolled back.

B. All the statements before the DELETE statement would be implicitly committed within the
session.

C. All the statements up to the ALTER TABLE statement would be committed and the outcome of UPDATE statement would be rolled back.

D. All the statements up to the ALTER TABLE statement would be committed and the outcome of the UPDATE statement is retained uncommitted within the session.
D
When using the IS NULL operator, which Boolean value is returned when a NULL value exists?
TRUEE
You are the database administrator for a corporate organization. You need to perform the following database operations:

z Update the designation column in the employees table for those managers for whom the
productivity_score is greater than 85 in the productivity table.

z Insert a new row in the productivity_score table from the employees table for those employees who have completed working for six months. Any employees whose ID is not yet assigned also need to be considered for insertion

Which of the following statements about the operators is TRUE to achieve the desired results in the most efficient way? (Choose all that apply).

The EXISTS operator in the UPDATE statement.

The NOT EXISTS operator in the INSERT statement.

The IN operator in the UPDATE statement.

The NOT IN operator in the INSERT statement.
The EXISTS operator in the UPDATE statement.

The NOT EXISTS operator in the INSERT statement
You want to produce a report containing the total number of orders placed for a particular time period, including the total value of the orders. Which two aggregate functions should you use in your SQL statement?
SUM / COUNT
Which is the correct order of precedence of SQL clauses?
WHERE, GROUP BY, HAVING
Which of the following is a valid CREATE TABLE command?

A: CREATE TABLE ord_details
(ord_no NUMBER(2),
item_no NUMBER (3),
ord_date date DEFAULT NOT NULL,
CONSTRAINT ord_uq UNIQUE, CONSTRAINT ord_pk PRIMARY KEY (ord_no));

B: CREATE TABLE ord_details
(ord_no NUMBER(2) UNIQUE, NOT NULL,
item_no NUMBER (3),
ord_date date DEFAULT SYSDATE NOT NULL);

C: CREATE TABLE ord_details
(ord_no NUMBER(2),
item_no NUMBER (3),
ord_date date DEFAULT SYSDATE NOT NULL,
CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));

D: CREATE TABLE ord_details
(ord_no NUMBER(2) PRIMARY KEY,
item_no NUMBER (3) PRIMARY KEY,
ord_date date NOT NULL);
C: CREATE TABLE ord_details
(ord_no NUMBER(2),
item_no NUMBER (3),
ord_date date DEFAULT SYSDATE NOT NULL,
CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no));
If an UPDATE statement contains a SELECT statement as a subquery, can the subquery contain both a GROUP BY and a HAVING clause?
Yes
Which of the following queries would provide all the details (EMPID, SAL and HIREDATE) about the oldest employee in the company?

A: SELECT MIN (HIREDATE) FROM EMP;

B: SELECT * FROM EMP WHERE HIREDATE =
(SELECT MIN (HIREDATE) FROM EMP);

C: SELECT HIREDATE FROM EMP WHERE HIREDATE=MAX(HIREDATE) ;

D: SELECT * FROM EMP WHERE HIREDATE =
(SELECT MAX (HIREDATE) FROM EMP);
B: SELECT * FROM EMP WHERE HIREDATE =
(SELECT MIN (HIREDATE) FROM EMP);
UNION ALL operator is similar to OUTER JOIN - Correct or Incorrect ?
Incorrect
The outer query stops evaluating the result set of the inner query when the fist value is found - Correct or Incorrect regarding EXIST operator used in Correlated Subquery ?
Correct
Every user has to update the data dictionary after every database activity - Correct or Incorrect about Oracle Data Dictionary ?
Incorrect
You need to create a table for a banking application with the following considerations:

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

3) date type data without using the conversion functions.

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

5) 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. INTERVAL YEAR TO MONTH

B. INTERVAL DAY TO SECOND

C. TIMESTAMP WITH TIME ZONE

D. TIMESTAMP WITH LOCAL TIME ZONE
B
Which is the default join type for a join operation in Oracle?
Inner Join
You want to generate a hierarchical report for all the employees who report to the employee whose EMP_ID is 200. Which SQL clauses would you require to accomplish the task?
WHERE / CONNECT BY / START WITH
Which date-time functions converts a TIMESTAMP value to a TIMESTAMP WITH TIME ZONE value?
FROM_TZ
Which three functions convert case for character strings?
UPPER, LOWER, and INITCAP
Which user accounts is used to create a PUBLIC role?
SYS
A role can be granted to PUBLIC - Correct or Incorrect about ROLES ?
Correct
They are granted on database objects by the owner of the object - Correct or Incorrect about System Privileges ?
Incorrect
Which SQL SELECT statement clause is an example of the selection capability, but NOT the joining capability?
WHERE d.deptno = 10
Which is a defining characteristic of a complex view, rather than a simple view?
Performing an aggregation / Joining two tables
Which conversion functions is used to convert a string to a timestamp data type?
TO_TIMESTAMP
ALTER TABLE product DISABLE CONSTRAINT supplier_id_fk; For which task would you issue this statement?
to deactivate the FOREIGN KEY constraint on the PRODUCT table
Which table types allows data to be broken down into small pieces?
Partitioned table
Which statements will delete all the records from the table T1?
DELETE FROM T1; / TRUNCATE TABLE T1; / DELETE T1;
Subqueries can contain GROUP BY clause - Correct or Incorrect ?
Correct
Which class of data dictionary views displays names of objects on which the user either owns or has been granted access rights?
ALL_
Which statements does NOT indicate the end of a transaction?
After a SAVEPOINT is issued
Which optimizers CANNOT use function based indexes?
Rule Based Optimizer
The student table contains these columns:

Id NUMBER(9)
last_name VARCHAR2(25)
first_name VARCHAR2(25)
enroll_date DATE

Evaluate these two statements:

Statement 1
----------------
SELECT CONCAT(INITCAP(first_name), INITCAP(last_name)) FROM student
WHERE enroll_date < '31-DEC-2007';

Statement 2
---------------
SELECT INITCAP(first_name) || INITCAP(last_name) FROM student
WHERE enroll_date < '31-DEC-2007';

Which of the following statements is true?

The two statements will display the same data.

The two statements will not display the same data.

One of the statements will fail because it contains a syntax error.

The two statements will retrieve the same data, but the display format of the returned values will differ
The two statements will display the same data.
Consider the exhibit below:

MERGE INTO EMPNEW A
USING EMP B
ON (A.EMPNO = B.EMPNO)
WHEN MATCHED THEN
UPDATE SET
A.SAL=B.SAL,
A.COMM=B.COMM
WHERE B.DEPTNO IN (20, 30)
WHEN NOT MATCHED THEN
INSERT VALUES (B.EMPNO, B.ENAME, B.JOB, B.MGR, B.HIREDATE, B.SAL,
B.COMM, B.DEPTNO)
WHERE B.DEPTNO IN (20, 30);

What work will merge statement do?

Each correct answer represents a complete solution. Choose all that apply.

A: Merge and Update SAL and COMM data from EMP to EMPNEW for Departments 20 and 30.

B: Merge and Insert new data from EMPNEW to EMP.

C: Merge and Update SAL and COMM data from EMPNEW to EMP for Departments 20 and 30.

D: Merge and Insert new data from EMP to EMPNEW for Departments 20 and 30.
A: Merge and Update SAL and COMM data from EMP to EMPNEW for Departments 20 and 30.

D: Merge and Insert new data from EMP to EMPNEW for Departments 20 and 30.
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its
database, which is configured for its default settings. The database contains a table
named Employees. You want to generate a report that will contain the last name of employees who are working as sales representatives. The table contains a column named Job_id, which specifies the type of employment.

Assuming that the Job_id value for a sales representative is SA_REP, which of the following SQL statements will you use to accomplish the task?


A: SELECT Emp_last_name FROM Employees WHERE Job_id = SA_REP;

B: SELECT Emp_last_name FROM Employees WHERE Job_id = 'Sa_rep';

C: SELECT Emp_last_name FROM Employees WHERE Job_id = Sa_rep;

D: SELECT Emp_last_name FROM Employees WHERE Job_id = 'SA_REP';
D: SELECT Emp_last_name FROM Employees WHERE Job_id = 'SA_REP';
What result is returned by the following statement? SELECT COUNT(*) FROM DUAL;
1
You want to generate a list of employees are in department 30, have been promoted from clerk to associate by querying the employee and employee_hist tables. The employee_hist table has the same structure as the employee table. The job_id value for clerks is 1 and the job_id value for associates is 6.

Which query should you use?

SELECT employee_id, emp_lname, emp_fname, dept_id FROM employee
WHERE (employee_id, dept_id) IN
(SELECT employee_id, dept_id
FROM employee_hist WHERE dept_id = 30 AND job_id = 1) AND job_id = 6;

SELECT employee_id, emp_lname, emp_fname, dept_id FROM employee
WHERE (employee_id) IN
(SELECT employee_id FROM employee_hist WHERE dept_id = 30 AND job_id = 1);

SELECT employee_id, emp_lname, emp_fname, dept_id FROM employee
WHERE (employee_id, dept_id) =
(SELECT employee_id, dept_id FROM employee_hist WHERE dept_id = 30 AND job_id = 6);

SELECT employee_id, emp_lname, emp_fname, dept_id FROM employee
WHERE (employee_id, dept_id) IN
(SELECT employee_id, dept_id
FROM employee WHERE dept_id = 30)
AND job_id = 6;

SELECT employee_id, emp_lname, emp_fname, dept_id FROM employee_hist
WHERE (employee_id, dept_id) =
(SELECT employee_id, dept_id FROM employee_hist WHERE dept_id = 30
AND job_id = 1) AND job_id = 6;
SELECT employee_id, emp_lname, emp_fname, dept_id
FROM employee
WHERE (employee_id, dept_id) IN
(SELECT employee_id, dept_id
FROM employee_hist
WHERE dept_id = 30 AND job_id = 1) AND job_id = 6;
Using the WHERE clause before the GROUP BY clause excludes the rows before creating groups - Correct or Incorrect ?
Correct
View the Exhibit and examine the structure of the CUST table.

Evaluate the following SQL statements executed in the given order:

ALTER TABLE cust
ADD CONSTRAINT cust_id_pk PRIMARY KEY(cust_id) DEFERRABLE INITIALLY DEFERRED;

INSERT INTO cust VALUES (1 /RAJ1); --row 1

INSERT INTO cust VALUES (1 ,'SAM); --row 2

COMMIT;

SET CONSTRAINT cust_id_pk IMMEDIATE;

INSERT INTO cust VALUES (1 /LATA1); --row 3

INSERT INTO cust VALUES (2 .KING1); --row 4

COMMIT;

Which rows would be made permanent in the CUST table?

A. row 4 only
B. rows 2 and 4
C. rows 3 and 4
D. rows 1 and 4
C
Plan stability is supported for multitable insert statements - Correct or Incorrect ?
Incorrect
All of the following are DBA views that are used to describe all relational tables in the database except for which one?

Each correct answer represents a complete solution. Choose all that apply.

A: ALL_TABLES
B: DBA_TAB_COLUMNS
C: USER_TABLES
D: DBA_TABLES
B: DBA_TAB_COLUMNS
A user can put a subquery in the FROM clause in the main query - Correct or Incorrect about Multiple-Column Subquery ?
Correct
You want to view all the object privileges granted to a database user on some specific columns of a table. Which of the following data dictionary views will you use to accomplish the task?
USER_COL_PRIVS_RECD / ALL_COL_PRIVS_RECD
View the Exhibit and examine the structure of the MARKS_DETAILS and MARKStables.

Which is the best method to load data from the MARKS DETAILStable to the MARKStable?

A. Pivoting INSERT
B. Unconditional INSERT
C. Conditional ALL INSERT
D. Conditional FIRST INSERT
A
Which operators is used in pattern matching?
LIKE
To join n tables together using Oracle proprietary join syntax, how many join conditions are needed in the WHERE clause?
n - 1
What two values can the GROUPING function return if the argument is a single column?
0 or 1
Can you modify data through a view that contains a GROUP BY clause?
No, you also CANNOT modify data if the view contains group functions, the DISTINCT keyword, or the ROWNUM pseudocolumn.
SELECT MOD('$13.3',2) FROM DUAL; - Correct or Incorrect ?
Incorrect
When using the TO_CHAR function to format a date value, are the use of upper and lower case characters significant in the format mask?
Yes
The data dictionary views consist of joins of dictionary base tables and user-defined tables - True or False regarding Data Dictionary Views ?
1
Which keywords should you use to revoke all privileges on a table?
All
Which clauses is used to limit the number of rows returned by a query?
WHERE
They allow users to execute a particular type of SQL statement - Correct or Incorrect about System Privileges ?
Correct
A sequence can only be used to create a primary key value - Correct or Incorrect about a Sequence ?
Incorrect
If SYSDATE returns 12-JUL-2009, what is returned by the following statement? SELECT TO_CHAR(SYSDATE, 'fmMONTH, YEAR') FROM DUAL;
JULY, TWO THOUSAND NINE
It contains the system privileges granted to other users by the current user session - Correct or Incorrect about the SESSION_PRIVS dictionary view ?
Incorrect
SQL can execute queries against a database - Correct or Incorrect about SQL ?
Correct
Which constraints is defined on a column so that Oracle Server can automatically create an index for the first column of a table?
UNIQUE
Which operators cannot be used with a subquery?
LIKE
The USER_CONSTRAINTS view in the data dictionary lists FOREIGN KEY constraints in the CONSTRAINT_TYPE column with which single-letter abbreviations?
R
The ADD clause of the ALTER TABLE statement is used to do what?
add a column or constraint to a table
Which is NOT the restriction on multitable inserts?
When performing multitable insert, a user can specify a table collection expression
Which statements correctly refers to unloading data?
It is the act of reading data from a table in the database and inserting it into an external table.
After executing the ALTER TABLE command, you can add a new column called ORDER_DATE to the ORDERS table - Correct or Incorrect about ALTER TABLE … SET UNUSED ?
Correct
You are the database administrator for a company that sells large multipurpose cubical containers.

You need to index the rows of the containers table based on the volume of the containers.

You create the con_volume function to compute the volume from the length, width, and height columns in the table.

Which of the following statements should you use to index the rows of the Containers table based on the volume? (Choose two. Each correct answer presents a complete solution.)

CREATE INDEX vol_index ON Containers (length, width, height);

CREATE INDEX vol_index ON Containers (length * width * height);

REATE INDEX vol_index ON Containers (con_volume);

CREATE INDEX vol_index ON Containers (con_volume());
CREATE INDEX vol_index ON Containers (length * width * height);

CREATE INDEX vol_index ON Containers (con_volume());
When a correlated query is processed the following steps are taken.

1. The inner query returns qualified rows only.
2. The final result set is displayed.
3. A row is fetched by the outer parent query.
4. The row is processed by the inner sub-query along with other column values.
5. The row values are passed on to the inner query.
6. The outer query processes the next row from the table in similar manner till no rows are left to be processed.

Which of the following is the correct order in which these steps are followed?

A: 3, 5, 4, 1, 6, 2
B: 3, 5, 1, 4, 6, 2
C: 5, 3, 1, 6, 4, 2
D: 6, 3, 5, 4, 1, 2
A: 3, 5, 4, 1, 6, 2
You work as a Database Developer for Dolliver Inc. The company uses Oracle as its database.

You use the ROUND (number) function with the SELECT statement as given below:

SELECT ROUND(15.193,-1) FROM DUAL;

What will be the result of the SQL statement?

A: 15.2
B: 20
C: 19
D: 15
B: 20
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. The database contains a table named Employee. You want to retrieve the salary of those employees who are not eligible for incentives and raise their salaries by 10% (rounded off to the nearest decimal place). You also want the message to be displayed as "The salary of <emp_name> after an increment is <emp_salary>.

Which of the following queries will you to accomplish the task?

A: SELECT 'The salary of' ||emp_name|| 'after a 10% increment is' ||ROUND
(emp_salary*1.10) FROM Employee WHERE emp_incentive IS NULL;

B: SELECT 'The salary of emp_name after a 10% increment is' ||ROUND
(emp_salary*1.10) FROM Employee WHERE emp_incentive IS NULL;

C: SELECT 'The salary of' ||emp_name|| 'after a 10% increment is' ||ROUND OFF
(emp_salary*1.10) FROM Employee WHERE emp_incentive IS NULL;

D: SELECT "The salary of" ||emp_name|| "after a 10% increment is" ||ROUND
(emp_salary*1.10) FROM Employee WHERE emp_incentive IS NULL;
A: SELECT 'The salary of' ||emp_name|| 'after a 10% increment is' ||ROUND
(emp_salary*1.10) FROM Employee WHERE emp_incentive IS NULL;
An INSERT statement can:
Add rows into more than one table / Add data into more than one column in a table
You work as a Database Developer for Softech Inc. The company sells books online, and maintains records in the Oracle database.
You need to create a table with the following specifications to store information of all customers of the company:

1. Customer ID (numeric data type) for each customer.
2. Customer Name (character data type), which stores the customer name.
3. Purchase Date, which stores the date when the customer purchased the book.
4. Status (character data type), which will contain the value if no data is entered.
5. Resume (character large object [CLOB] data type), which will contain the resume submitted by the customer.

Which of the following is the correct syntax to create the customer table?

A: CREATE TABLE 1_CUST
(cust_id NUMBER (4),
cust_name VARCHAR2(25),
purchase_date DATE,
c_status VARCHAR2(10) DEFAULT 'ACTIVE',
resume CLOB);

B: CREATE TABLE CUST_1
(cust_id NUMBER,
cust_name VARCHAR2(25),
purchase_date DATE,
c_status VARCHAR2(10) DEFAULT 'ACTIVE',
resume CLOB);

C: CREATE TABLE 1_CUST
(cust_id NUMERIC (4),
cust_name VARCHAR2(25),
purchase_date DATE,
c_status VARCHAR2(10) DEFAULT "ACTIVE",
resume CLOB);

D: CREATE TABLE CUST_1
(cust_id NUMERIC,
cust_name VARCHAR2(25),
purchase_date DATE,
c_status VARCHAR2(10) DEFAULT 'ACTIVE',
resume CLOB(3000));
B: CREATE TABLE CUST_1
(cust_id NUMBER,
cust_name VARCHAR2(25),
purchase_date DATE,
c_status VARCHAR2(10) DEFAULT 'ACTIVE',
resume CLOB);
A scalar subquery expression is a subquery that returns exactly one row - Correct or Incorrect about Scaler subquery ?
Incorrect
You work as a Database Developer for Gadgets Inc. The company uses Oracle as its
database. The database contains a table named Employees. You want to retrieve the last name and job id of those employees whose job id is same as that of employee id 101.

Which of the following SQL statements will you use to accomplish the task?

A: SELECT last_name, job_id
FROM Employees
WHERE job_id = SELECT job_id
FROM Employees WHERE employee_id = 101;

B: SELECT last_name, job_id
FROM Employees
WHERE job_id = 101;

C: SELECT last_name, job_id
FROM Employees
WHERE job_id = (SELECT job_id
FROM Employees WHERE employee_id = 101);

D: SELECT last_name, job_id
FROM Employees
WHERE job_id = (SELECT job_id
FROM Employees WHERE job_id = 101);
C: SELECT last_name, job_id
FROM Employees
WHERE job_id = (SELECT job_id
FROM Employees WHERE employee_id = 101);
You need to find the names of all the students that start with 'D' or 'd' and end with 'd' and is at least five letters long. Which patterns should you use to find the name of those students?
^(D|d)[[:alpha:]]{3, }d$
Which types of joins include primary and foreign key complements?
Equijoin
ORDER BY can sort rows based on data that isn’t displayed as part of the SELECT statement - Correct or Incorrect of ORDER BY clause ?
Correct
They help in storing data in database tables in a hierarchical way - Correct or Incorrect about Hierarchial Queries ?
Incorrect
Evaluate this SQL statement:

SELECT c.customer_id, o.order_id, o.order_date, p.product_name FROM customer c, curr_order o, product p WHERE customer.customer_id = curr_order.customer_id AND o.product_id = p.product_id ORDER BY o.order_amount;

This statement fails when executed.

Which change will correct the problem?

Use the table name in the ORDER BY clause.
nmlkj Remove the table aliases from the WHERE clause.

Include the order_amount column in the SELECT list.

Use the table aliases instead of the table names in the WHERE clause.

Remove the table alias from the ORDER BY clause and use only the column name
Use the table aliases instead of the table names in the WHERE clause
Which clause of a CREATE SEQUENCE statement specifies the starting value for the sequence?
START WITH n
What function and arguments would modify the way the hire_date is displayed in a SELECT statement such that hire_date values appear formatted in this way: January 27, 2006?
to_char(hire_date, 'fmMonth dd, yyyy')
To define one or more values to be assigned to existing rows in an UPDATE statement - True or False regarding the Use of Subquery ?
1
A query can have a subquery embedded within it. Under what circumstances could there be more than one subquery?
Subqueries can be embedded within each other with no practical limitations on depth
Which are single-row character-case conversion functions?
LOWER, INITCAP
The SELECT statement is used to select data from a database - Correct or Incorrect about SELECT statements ?
Correct
Currently, you are connected to the database. You want to display the names of roles that are currently enabled for you. Which of the following data dictionary views will you query to accomplish this?
SESSION_ROLES
A UNIQUE constraint on a column requires an index - If a NONUNIQUE index already exists on the column, a UNIQUE index will be created implicitly - Correct or Incorrect ?
Incorrect
Which privilege can only be granted to a user and NOT to a role?
REFERENCES
Indexes are easy to use and provides immediate value - Correct or Incorrect about Indexes ?
Correct
What are object types composed of?
Attributes and methods
Which statements correctly defines a non-correlated subquery?
It is a set of one or more sequential queries in which generally the result of the inner query is used as the search value in the outer query.
Which type of constraint can only be specified at the column level?
NOT NULL
An UPDATE statement can update multiple columns in one table by using multiple columns in which clause?
The SET clause. When multiple columns are included in the SET clause, they should be separated by commas
In a SELECT list, what character should enclose date and character literal values?
single quotation marks (')
Which statements is used to create an external table?
CREATE TABLE...ORGANIZATION EXTERNAL
A SELECT * query will not retrieve data from unused columns - Correct or Incorrect about ALTER TABLE … SET UNUSED ?
Correct
SELECT oldest_flashback_scn FROM V$FLASHBACK_DATABASE_LOG; Which of the following outputs will you receive as a result of the SQL statement?
An approximate system change number (SCN) to which a database can be flashed back.
What will be the output of the following query?

SELECT CEIL(268651.894, 2) FROM DUAL;

A: 268652
B: Oracle Error
C: 268651.89
D: 268651.90
B: Oracle Error
Which of these operators will remove duplicate rows from the final result?
INTERSECT, MINUS, UNION
Which of the following will be the result of executing the following SQL statement?

SELECT TRUNC(SYSDATE,'YEAR') FROM DUAL;

Assume that the value of SYSDATE is equal to 30-DEC-2008.

A: 30-DEC-2007
B: 01-JAN-2008
C: 31-DEC-2008
D: 01-JAN-2007
B: 01-JAN-2008
You maintain the genetic database for a research and development team. You need to display the ancestry of a person named Peter Clark. Up to five generations, including Peter's own generation, need to be displayed such that the ancestors of same generation are in alphabetical order.

Which of the following queries should you use to determine the family tree?

SELECT * FROM GeneRecords
WHERE LEVEL<=5
START WITH FirstName="Peter" AND LastName="Clark"
CONNECT BY ParentID=PRIOR PersonID;

SELECT * FROM GeneRecords
WHERE LEVEL<5
START WITH FirstName="Peter" AND LastName="Clark"
CONNECT BY PRIOR ParentID=PersonID;

SELECT * FROM GeneRecords
WHERE LEVEL<=5
START WITH FirstName="Peter" AND LastName="Clark"
CONNECT BY ParentID=PRIOR PersonID
ORDER SIBLINGS BY FirstName;

SELECT * FROM GeneRecords
WHERE LEVEL<5
START WITH FirstName="Peter" AND LastName="Clark"
CONNECT BY PRIOR ParentID=PersonID
ORDER SIBLINGS BY FirstName;
SELECT * FROM GeneRecords
WHERE LEVEL<=5
START WITH FirstName="Peter" AND LastName="Clark"
CONNECT BY ParentID=PRIOR PersonID
ORDER SIBLINGS BY FirstName;
ROUND(number)
ROUND (number)

ROUND returns n rounded to integer places to the right of the decimal point. If you omit integer, then n is rounded to zero places. If integer is negative, then n is rounded off to the left of the decimal point.
n can be any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. If you omit integer, then the function returns the value ROUND(n, 0) in the same data type as the numeric data type of n. If you include integer, then the function returns NUMBER.

ROUND is implemented using the following rules:

1. If n is 0, then ROUND always returns 0 regardless of integer.

2. If n is negative, then ROUND(n, integer) returns -ROUND(-n, integer).

3. If n is positive, then
ROUND(n, integer) = FLOOR(n * POWER(10, integer) + 0.5) * POWER(10, -integer)

ROUND applied to a NUMBER value may give a slightly different result from ROUND applied to the same value expressed in floating-point. The different results arise from differences in internal representations of NUMBER and floating point values. The difference will be 1 in the rounded digit if a difference occurs.

The following example rounds a number to one decimal point:

SELECT ROUND(15.193,1) "Round" FROM DUAL;

Round
----------
15.2

The following example rounds a number one digit to the left of the decimal point:

SELECT ROUND(15.193,-1) "Round" FROM DUAL;

Round
----------
20
The outer query continues evaluating the result set of the inner query until all the values in the result set are processed - Correct or Incorrect regarding EXIST operator ?
Incorrect
View the Exhibit and examine the description of EMPLOYEES and DEPARTMENTS tables.

You want to display the EMPLOYEE_ID, LAST_NAME, and SALARY for the employees who get the maximum salary in their respective departments. The following SQL statement was written:

WITH
SELECT employee_id, last_name, salary
FROM employees
WHERE (department_id, salary) = ANY (SELECT*
FROM dept_max) dept_max as (SELECT d.department_id, max(salary)
FROM departments d JOIN employees j
ON (d. department_id = j. department_id)
GROUP BY d. department_id);

Which statement is true regarding the execution and the output of this statement?

A. The statement would execute and give the desired results.

B. The statement would not execute because the = ANY comparison operator is used instead of=.

C. The statement would not execute because the main query block uses the query name before it
is even created.

D. The statement would not execute because the comma is missing between the main query block
and the query name
C
Which metacharacters is also known as backreference?
n
When using the ORDER BY clause, it always appears as the last clause in a SELECT statement - Correct or Incorrect of ORDER BY clause ?
Correct
If you have a five column list with the CUBE extension, how many combinations would be created in the result set?
25 or 32 combinations
Evaluate the following SQL statement:

SELECT employee_id, last_name, job_id, manager_id
FROM employees
START WITH employee_id = 101
CONNECT BY PRIOR employee_id=manager_id;

Which statement is true regarding the output for this command?

A. It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101,
followed by his or her peers.

B. It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101,
followed by the employee to whom he or she reports.

C. It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is 101,
followed by employees below him or her in the hierarchy.

D. It would return a hierarchical output starting with the employee whose EMPLOYEE_ID is101,
followed by employees up to one level below him or her in the hierarchy.
C
Rows can be inserted either conditionally or unconditionally into a table - Correct or Incorrect about Multi table Insert ?
Correct
How do you create a sequence that generates descending sequence values?
Specify a negative value in the INCREMENT BY clause. For example, INCREMENT BY -1 would generate sequential descending values.
Evaluate the following SQL statement:

SELECT TO_CHAR(list_price ,'$9,999")
FROM product_information;

Which two statements would be true regarding the output for this SQL statement?
(Choose two.)

A. The LIST_PRICE column having value 1123.90 would be displayed as $1,124.

B. The LIST_PRICE column having value 1123.90 would be displayed as $1,123.

C. The LIST_PRICE column having value 11235.90 would be displayed as $1,123.

D. The LIST_PRICE column having value 11235.90 would be displayed as #######.
A,D
Which data dictionary views contains information about columns that have been marked as UNUSED?
DBA_UNUSED_COL_TABS
It produces only the grand totals for the groups specified in the GROUP BY clause - Correct or Incorrect regarding ROLLUP operator ?
Incorrect
To define the set of rows to be inserted into the target table of an INSERT or CREATE TABLE statement - True or False regarding the Use of Subquery ?
TRUE
The GROUPING function can only work:
With the GROUP BY clause
Oracle allows limited number of subqueries in the FROM clause True or False in Regard to Subquery ?
1
Single-row Functions may have zero or more input parameters - True or False ?
1
SELECT NVL(SUBSTR('abc',4), 'No such substring found') FROM DUAL; - Correct or Incorrect ?
Correct
View columns that are the result of derived values must be given a column alias - Correct or Incorrect concerning the creation of a view ?
Correct
A role cannot be assigned external authentication - Correct or Incorrect about ROLES ?
Incorrect
One cannot perform DML operations directly against simple views - Correct or Incorrect about Simple View ?
Incorrect
USER()
USER()

USER returns the name of the session user (the user who logged on) with the data type VARCHAR2. Oracle Database compares values of this function with blank-padded comparison semantics.

In a distributed SQL statement, the UID and USER functions together identify the user on your local database. You cannot use these functions in the condition of a CHECK constraint.

The following example returns the current user and the user's UID:

SELECT USER, UID FROM DUAL;
In which subqueries are rows in the subquery results evaluated in the main query in pair-wise comparison?
Multiple-column subquery
Which statement would you use to change the name of a table, view, sequence, or synonym?
RENAME. The syntax is RENAME old_name TO new_name;
What is maximum size of length a VARCHAR2 column can have?
4000
Which constraints, if present in a table, creates a problem for a user to rebuild an index?
Foreign key constraint
Heap tables cannot be indexed - True or False ?
1
The sales_date column should be empty for the ALTER TABLE command to execute successfully - Correct or Incorrect about ALTER TABLE … SET UNUSED ?
Incorrect
The Flashback Version Query returns a table with a row for each version of the row that existed at any time during the time interval specified - Correct or Incorrect about FLASHBACK Version Query?
Correct
Multitable Insert can only conditionally insert values in tables - Correct or Insert ?
Incorrect
A non-deferrable primary key or unique key constraint in a table automatically creates a unique index - Correct or Incorrect about INDEXES ?
Correct
In which set operator are duplicate rows included in the result set?
UNION ALL
The following SQL statement was written to retrieve the rows for the PRODUCT_ID that has a UNIT_PRICE of more than 1,000 and has been ordered more than five times:

SELECT product_id, COUNT(order_id) total, unit_price
FROM order_items
WHERE unit_price>1000 AND COUNT(order_id)>5
GROUP BY product_id, unit_price;

Which statement is true regarding this SQL statement?

A. The statement would execute and give you the desired result.

B. The statement would not execute because the aggregate function is used in the WHERE clause.

C. The statement would not execute because the WHERE clause should have the OR logical operator instead of AND.

D. The statement would not execute because in the SELECT clause, the UNIT_PRICE column is
placed after the column having the aggregate function.
B
Evaluate this CREATE TABLE statement:

CREATE TABLE curr_order (
id NUMBER,
customer_id NUMBER,
emp_id NUMBER,
order_dt TIMESTAMP WITH LOCAL TIME ZONE,
order_amt NUMBER(7,2),
ship_method VARCHAR2(5));

Which statement about the order_dt column is true?

Data will be normalized to the database time zone.

Data will include a time zone displacement in its value.

Data will be stored using a fractional seconds precision of 3.

Data stored in the column will be returned in the server's local time zone
Data will be normalized to the database time zone
NULLIF()
NULLIF()

NULLIF compares expr1 and expr2. If they are equal, then the function returns null.
If they are not equal, then the function returns expr1. You cannot specify the literal NULL for expr1.

If both arguments are numeric data types, then Oracle Database determines the argument with the higher numeric precedence, implicitly converts the other argument to that data type, and returns that data type. If the arguments are not numeric, then they must be of the same data type, or Oracle returns an error.

The NULLIF function is logically equivalent to the following CASE expression:

CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its
database. The database contains a table named Employee. You issue the following SQL
query against the table:

SELECT emp_name
FROM employee
WHERE REGEXP_LIKE(emp_name, '^m', 'i');

What will be the result of the above SQL query?

Each correct answer represents a complete solution. Choose two.

A: mark
B: Michael
C: Ivan
D: izziel
A: mark
B: Michael
Which tasks CANNOT be performed using regular expression support in Oracle Database?
concatenate two strings
Which keyword used with group functions causes the function to only consider unique values?
DISTINCT
Which SET operator should be used in the blank space in the following SQL statement to display the cities that have departments located in them?

SELECT location_id, city
FROM locations

----------------------------

SELECT location_id, city
FROM locations JOIN departments USING(location_id);

A. UNION
B. MINUS
C. INTERSECT
D. UNION ALL
C
A multitable INSERT statement Can use conditional logic - Correct or Incorrect ?
Correct
Which option of the CREATE SEQUENCE or ALTER SEQUENCE statement indicates the largest value that the sequence can generate?
MAXVALUE n
The account table contains these columns:

account_id NUMBER(12)
new_purchases NUMBER(7,2)
prev_balance NUMBER(7,2)
finance_charge NUMBER(7,2)
payments NUMBER(7,2)

You must print a report that contains the account number and the current balance for a particular customer. The current balance consists of the sum of an account's previous balance, new purchases, and finance charge. You must calculate the finance charge based on a rate of 3.9% of the previous balance. Payments must be deducted from this amount. The customer's account number is 543842.

Which SELECT statement should you use?

SELECT new_balance + finance_charge - payments FROM account
WHERE account_id = 543842;

SELECT account_id, new_purchases + prev_balance * 1.039 - payments
FROM account WHERE account_id = 543842;

SELECT account_id, new_purchases + (prev_balance * .039) - payments
FROM account WHERE account_id = 543842;

SELECT account_id, new_purchases + (prev_balance * 1.039) + finance_charge -
payments FROM account
WHERE account_id = 543842;
SELECT account_id, new_purchases + prev_balance * 1.039 - payments FROM account
WHERE account_id = 543842;
If no ORDER BY clause is included in a SELECT statement, how are the results sorted?
The order of the results will be unpredictable. Each time the query is run, the order in which the rows are displayed may be different.
You work as a Database Administrator for uCertify Inc. The company uses an Oracle database. Andrew is an employee in the company.
You create a role named UserRole4 and grant few privileges to the role. You assign the role to Andrew, but you do not include it in Andrew's list of default roles. Andrew connects to the database. He wants to enable the role, as he wants to exercise the privileges that you granted him through the role.

Which of the following statements will he use to accomplish this?

A: ALTER USER Andrew SET ROLE UserRole4;
B: SET ROLE UserRole4;
C: ENABLE ROLE UserRole4;
D: ALTER SESSION ENABLE ROLE UserRole4;
B: SET ROLE UserRole4;
Which values can be set for the TIME_ZONE session parameter by using the ALTER SESSION command?
dbtimezone / '-8:00' / local
SELECT * FROM OrdersInfo GROUP BY GROUPING SETS ProductID, (OrderID, OrderDate), ROLLUP (OrderID, Cost, DeliveryStatus); How many groups are created in total as a result of the given query?
6
If you want to retrieve the minimum and maximum salary from the SAL column in the EMP table, which types of functions will you use?
Grouping functions
Which forms of subquery never returns more than one row?
Scalar
When would you use an ORDER BY clause in a subquery?
to perform Top-n Analysis
Single-row functions can only be used in SELECT and WHERE clauses - True or False ?
1
Which values can be set for the TIME_ZONE session parameter by using the ALTER SESSION command?
-8:00, local, dbtimezone
You grant the CREATE VIEW privilege to a database user named John. Which operations is John able to perform?
Create a view in his own schema
To create a Public Synonym you need the CREATE PUBLIC SYNONYM privilege - Correct or Incorrect about Synonyms ?
Correct
REMAINDER()
REMAINDER()

REMAINDER returns the remainder of n2 divided by n1.

This function takes as arguments any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. Oracle determines the argument with the highest numeric precedence, implicitly converts the remaining
arguments to that data type, and returns that data type.

The MOD function is similar to REMAINDER except that it uses FLOOR in its formula,
whereas REMAINDER uses ROUND.
User Marilyn wants to eliminate the need to type the full table name when querying the TRANSACTION_HISTORY table in her schema. All other database users should use the schema and full table name when referencing this table. Which statement should user Marilyn execute?
CREATE SYNONYM trans_hist FOR transaction_history;
The BLOB data type column is used to store binary data in an operating system file - True or False about Oracle Data Types ?
1
What value will always be returned in comparisons between nulls and other values?
an unknown value (or NULL)
Which of the following is the basic unit of storage in the Oracle database?
Table
DELETE should be used when a conditional delete is to be performed - Correct or Incorrect ?
Correct
If the query block name and the table name were the same, then the table name would take precedence - Correct or Incorrect regarding the usage of WITH clause in complex correlated queries ?
Incorrect
Which clause of the SQL statement will allow you to specify a CREATE INDEX statement as part of the CREATE TABLE SQL statement?
USING INDEX
Multitable inserts cannot be performed via a DB link - Correct or Incorrect ?
Correct
If either the child or parent object is a view, then the constraint is subject to all restrictions on view constraints - Correct or Incorrect about FOREIGN KEY constraint ?
Correct
Which constitute a single transaction?
Multiple DML statements / A single DDL statement / A Single DCL statement
Which set operator returns all the results from two queries after eliminating any duplicates?
UNION
Examine the structures of the curr_order and line_item tables:

curr_order
-------------------------
order_id NUMBER(9)
customer_id NUMBER(9)
order_date DATE
ship_date DATE

line_item
------------------
line_item_id NUMBER(9)
order_id NUMBER(9)
product_id NUMBER(9)
quantity NUMBER(5)

The order_id column in the line_item table has a FOREIGN KEY constraint to the curr_order table.

Which statement about these two tables is true?

To insert a record into the curr_order table, you must insert a record into the line_item table.

To delete a record from the curr_order table, you must delete any child records in the line_item table.

To update a record in the curr_order table, the parent record must already exist in the line_item table.

To remove the constraint from the line_item table, you must delete all the records in the curr_order
table.

To delete a record from the line_item table, you must delete the associated record in the curr_order table.

When a record is deleted from the line_item table, the associated parent record in the curr_order table is also deleted.
To delete a record from the curr_order table, you must delete any child records in the line_item table.
MOD()
MOD returns the remainder of n2 divided by n1. Returns n2 if n1 is 0.

This function takes as arguments any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. Oracle determines the argument with the highest numeric precedence, implicitly converts the remaining
arguments to that data type, and returns that data type.

The following example returns the remainder of 11 divided by 4:

SELECT MOD(11,4) "Modulus"
FROM DUAL;

Modulus
----------
3
You are the database administrator of a public school. You need to find the names of all the students that start with 'D' or 'd' and end with 'd' and is at least five letters long.

Which of the following patterns should you use to find the name of those students?

^D{3, }d$
^D{3}d$
^(D|d).{3, }d$
^(D|d)[[:alpha:]]{3, }d$
^(D|d)[[:alpha:]]{3, }d$
You want to create a view that when queried will display the name, customer identification number, new balance, finance charge, and credit limit of all customers. When queried, the display should be sorted by credit limit from highest to lowest, then by last name alphabetically. The view definition should be created regardless of the existence of the customer and account tables. No DML may be performed when using this view.

Evaluate these statements:

CREATE OR REPLACE FORCE VIEW cust_credit_v
AS SELECT c.last_name, c.first_name, c.customer_id, a.new_balance, a.finance_charge,
a.credit_limit FROM customer c, account a
WHERE c.account_id = a.account_id
WITH READ ONLY;

SELECT * FROM cust_credit_v
ORDER BY credit_limit DESC, last_name;

Which of the following statements is true?

When both statements are executed, all of the desired results are achieved.

The CREATE VIEW statement will fail because a view may not be created on tables that do not exist or are not accessible by the user.

The statements will not return all of the desired results because the WITH CHECK OPTION clause is not included in the CREATE VIEW statement.

To achieve all of the desired results this ORDER BY clause should be added to the CREATE VIEW statement:
ORDER BY a.credit_limit DESC, c.last_name.
When both statements are executed, all of the desired results are achieved.
If no GROUP BY clause or WHERE clause is included in a simple SELECT statement, what would the COUNT(*) function return?
the number of rows in the table
Two tables exist which have identical structures.

The two tables are called current_emp and previous_emp.

The table current_emp holds the rows of employees who currently work for the company, while previous_emp holds the rows of employees who previously worked for the company. Here are the table layouts:

current_emp (table name)
id number(4) primary key
name varchar2(25)
salary number(7,2)
dept_id number(2)

previous_emp (table name)
id number(4) primary key
name varchar2(25)
salary number(7,2)
dept_id number(2)

The requirement is to find all current employees who work in dept_id 10 whose salary is less than the salary of every one of the previous employees.

The user issues the following statement:

SELECT * FROM current_emp WHERE DEPT_ID = 10 and salary < (SELECT MIN(salary) FROM previous_emp) ;

What are the results?

The statement will execute but it won't find the desired rows

The statement will not execute because the operator IN should be used when there is more than one row in the table you are searching

The statement will execute and it will find the desired rows

The statement will execute but the > operator needs to be replaced with a < in order to find the desired results
The statement will execute and it will find the desired rows
Multitable Insert can be used to enter values in only two tables at a time - Correct or Incorrect ?
Incorrect
The mgr_id column currently contains manager identification numbers, and you need to allow users to include text characters in the identification values.

Which statement should you use to implement this?

ALTER employee
MODIFY (mgr_id VARCHAR2(15));

ALTER TABLE employee
MODIFY (mgr_id VARCHAR2(15));

ALTER TABLE employee
REPLACE (mgr_id VARCHAR2(15));

ALTER employee TABLE
MODIFY COLUMN (mgr_id VARCHAR2(15));

You cannot modify the data type of the mgr_id column.
You cannot modify the data type of the mgr_id column
Which is the boolean operator that evaluates to true if either of the conditions in an expression is true?
OR
You are a DBA for a university. You execute the following query to retrieve data about the graduate and postgraduate students enrolled in an MBA program:

SQL> SELECT * FROM graduatestudents
UNION ALL
SELECT * FROM postgraduatestudents;

Which of the following statements is TRUE about the preceding query?

It displays only the rows common to the graduatestudents and postgraduatestudents tables.

It displays the rows that exist in the graduatestudents table but not in the postgraduatestudents table.

It displays the rows that exist in the graduatestudents and the postgraduatestudents tables, including any duplicate rows.

It displays the rows that exist in the graduatestudents and the postgraduatestudents tables, excluding any duplicate rows.
It displays the rows that exist in the graduatestudents and the postgraduatestudents tables, including any duplicate rows.
Which clauses will return a row that contains the subtotal for each group of rows, and also returns an additional row specifying the total of all the groups?
ROLLUP
Group Functions can be used on columns or expressions - Correct or Incorrect ?
Correct
The order of grouping columns is not important - Correct or Incorrect about ROLLUP operation ?
Incorrect
Which of the following GROUP BY operations is most likely to produce the greatest number of rows of output, all other things being equal?
CUBE
At least one join condition is present in most of the join queries. In which clauses can this join condition be placed?
WHERE / FROM
Conversion functions convert a column definition from one data type to another data type - True or False ?
1
If today is March 12, 2012, at exactly 12 o'clock noon, what will be the result of executing the statement SELECT sysdate - to_date('12-Mar-2012') FROM dual;?
0.5
When adding a DATE datatype and a NUMBER datatype, which datatype is the result?
a DATE datatype
Subqueries are mostly found in the WHERE clause, which are also known as nested subqueries - True or False in Regard to Subquery ?
1
It fetches data from one database table only - Correct or Incorrect about Simple View ?
Correct
TO_CHAR (number)
TO_CHAR (number)

TO_CHAR (number) converts n to a value of VARCHAR2 data type, using the optional
number format fmt. The value n can be of type NUMBER, BINARY_FLOAT, or BINARY_
DOUBLE. If you omit fmt, then n is converted to a VARCHAR2 value exactly long enough to hold its significant digits.

If n is negative, then the sign is applied after the format is applied. Thus TO_CHAR(-1, '$9') returns -$1, rather than $-1.

The 'nlsparam' argument specifies these characters that are returned by number
format elements:
■ Decimal character
■ Group separator
■ Local currency symbol
■ International currency symbol

This argument can have this form:
'NLS_NUMERIC_CHARACTERS = ''dg''
NLS_CURRENCY = ''text''
NLS_ISO_CURRENCY = territory '

The characters d and g represent the decimal character and group separator,respectively. They must be different single-byte characters. Within the quoted string,you must use two single quotation marks around the parameter values. Ten characters are available for the currency symbol
.
If you omit 'nlsparam' or any one of the parameters, then this function uses the
default parameter values for your session.

The following statement uses implicit conversion to combine a string and a number into a number:

SELECT TO_CHAR('01110' + 1) FROM DUAL;
TO_C
----
1111
DELETE <sequence name> would remove a sequence from the database - Correct or Incorrect about Sequences created in a single instance database ?
Incorrect
You granted user Joe the INDEX and REFERENCES privileges on the INVENTORY table. Which statement did you use?
GRANT ALL ON inventory TO joe;
In the SELECT clause of a SQL statement, what is the term for the list of one or more columns to be returned by the query?
the SELECT list
Tables in a heap do not have a primary key - True or False ?
1
Which are the correct and valid ways of putting a comment in an Oracle program?
-- (two dashes), /*...*/
Their metadata information is stored inside the data dictionary - Correct or Incorrect about EXTERNAL tables ?
Correct
Which values is returned after the following SQL statement is executed? SELECT ADD_MONTHS(SYSDATE,-1) FROM DUAL: Assume the value of SYSDATE to be 31-JUL-2008 12:05pm
30-JUN-2008 12:05pm
An alias can be specified for the table into which rows are inserted - Correct or Incorrect about Multi table Insert ?
Incorrect
It can be used in subqueries contained only in a SELECT statement - Correct or Incorrect about FLASHBACK Version Query?
Incorrect
It is not possible to update rows in a read-only materialized view - Correct or Incorrect about UPDATE statements ?
Correct
Which is considered an acceptable query with V$DATAFILE?
A query that displays rows from the table with no joins
By default, how is the output of the UNION ALL set operator sorted?
It is not sorted.
NEXT_DAY()
NEXT_DAY returns the date of the first weekday named by char that is later than the date date. The return type is always DATE, regardless of the data type of date. The argument char must be a day of the week in the date language of your session, either the full name or the abbreviation. The minimum number of letters required is the
number of letters in the abbreviated version. Any characters immediately following the valid abbreviation are ignored. The return value has the same hours, minutes, and seconds component as the argument date

This example returns the date of the next Tuesday after October 15, 2009:

SELECT NEXT_DAY('15-OCT-2009','TUESDAY') "NEXT DAY" FROM DUAL;

NEXT DAY
--------------------
20-OCT-2009 00:00:00
View the Exhibit and examine the table structure of DEPARTMENTS and LOCATIONS tables.

You want to display all the cities that have no departments and the departments that have not
been allocated cities.

Which type of join between DEPARTMENTS and LOCATIONS tables would produce this
information as part of its output?

A. NATURAL JOIN
B. FULL OUTER JOIN
C. LEFT OUTER JOIN
D. RIGHT OUTER JOIN
B
View the Exhibit and examine the data in EMP and DEPT tables.

In the DEPT table, DEPTNO is the PRIMARY KEY.

In the EMP table, EMPNO is the PRIMARY KEY and DEPTNO is the FOREIGN KEY referencing
the DEPTNO column in the DEPT table.

What would be the outcome of the following statements executed in the given sequence?

DROP TABLE emp;

FLASHBACK TABLE emp TO BEFORE DROP;

INSERT INTO emp VALUES (2,COTT 10);
INSERT INTO emp VALUES (3,ING 55);

A. Both the INSERT statements would fail because all constraints are automatically retrieved
when the table is flashed back.

B. Both the INSERT statements would succeed because none of the constraints on the table are
automatically retrieved when the table is flashed back.

C. Only the first INSERT statement would succeed because all the constraints except the primary key constraint are automatically retrieved after a table is flashed back.

D. Only the second INSERT statement would succeed because all the constraints except
referential integrity constraints that reference other tables are retrieved automatically after the
table is flashed back
D
Given below is the list of meta character syntaxes and their descriptions in random order:

Metacharacter syntax Description

1) ^a) Matches character not in the list

2) [^...] b) Matches character when it occurs at the beginning of a line

3) | c) Treats the subsequent
meta character as a literal

4) \ d) Matches one of the characters such as the OR operator

Identify the option that correctly matches the meta character syntaxes with their descriptions

A. 1-b, 2-a, 3-d.4-c
B. 1-a, 2-b, 3-d.4-c
C. 1-d, 2-b, 3-a.4-c
D. 1-b, 2-c, 3-d, 2-a
A
It can be used to specify an inline view -- Correct or Incorrect about the USING clause of MERGE statement ?
Correct
You work as a Database Developer for Gigabytes Inc. The company uses Oracle as its database. The database contains a table named Employee. You have created a primary constraint named emp_id_pk at the time of table creation.

On which of the following levels can constraint be created?

Each correct answer represents a complete solution. Choose two

A: Column
B: Index
C: Row
D: Table
A: Column
D: Table
Which clause of a SELECT statement includes a condition to restrict the rows returned by the query?
the WHERE clause
You work as a Database Developer for TechSoft Inc. The company uses Oracle as its database. The company has a table called Employee, shown in the exhibit:

NAME NULL? TYPE
Emp_ID NOT NULL NUMBER(4)
Join_date DATE
Department_ID NUMBER(3)
Department_location Varchar2(30)

The Employee table contains information of all employees working in the company.
Each and every employee has been assigned a Department _ID. You want to add a NOT NULL constraint to the Department_ID column.

Which of the following statements should you use to accomplish the task?

A: ALTER TABLE Employee
MODIFY CONSTRAINT Employee_Department_ID_nn NOT NULL (Department_ID);

B: ALTER TABLE Employee
MODIFY Department_ID CONSTRAINT Employee_Department_ID_nn NOT NULL;

C: ALTER TABLE Employee
ADD Department_ID NUMBER(6) CONSTRAINT Employee_Department_ID_nn NOT NULL;

D: ALTER TABLE Employee
ADD CONSTRAINT Employee_Department_ID_nn NOT NULL (Department_ID);
B: ALTER TABLE Employee
MODIFY Department_ID CONSTRAINT Employee_Department_ID_nn NOT NULL;
Group Functions can be passed as an argument to another group function - Correct or Incorrect ?
Correct
SELECT * FROM Products GROUP BY CUBE(ProductQuantity, ProductCost); Which statements is TRUE about the given query?
There are four groups of rows
In a SELECT statement, in which clause must you include all columns in the SELECT list that do NOT use a grouping function of some sort?
in the GROUP BY clause
It produces only the subtotals for the groups specified in the GROUP BY clause - Correct or Incorrect regarding ROLLUP operator ?
Incorrect
What is an alternative method of writing the following SELECT statement in SQL92
syntax?

SELECT E.EMPNO, E.ENAME, D.DNAME
FROM EMP E, DEPT D
WHERE E.DEPTNO=D.DEPTNO;

Each correct answer represents a complete solution. Choose all that apply.

A: SELECT EMPNO, ENAME, DNAME
FROM EMP LEFT OUTER JOIN DEPT
ON EMP.DEPTNO = DEPT.DEPTNO;

B: SELECT EMPNO, ENAME, DNAME
FROM EMP FULL OUTER JOIN DEPT
ON EMP.DEPTNO = DEPT.DEPTNO;

C: SELECT EMPNO, ENAME, DNAME
FROM EMP NATURAL JOIN DEPT;

D: SELECT EMPNO, ENAME, DNAME
FROM EMP INNER JOIN DEPT
ON EMP.DEPTNO = DEPT.DEPTNO;
C: SELECT EMPNO, ENAME, DNAME
FROM EMP NATURAL JOIN DEPT;

D: SELECT EMPNO, ENAME, DNAME
FROM EMP INNER JOIN DEPT
ON EMP.DEPTNO = DEPT.DEPTNO;
Which database object is an alternate name for a table or view?
a synonym
Which of the following SQL datatypes can store fractional seconds?
TIMESTAMP WITH LOCAL TIME ZONE / TIMESTAMP / INTERVAL DAY TO SECOND
Which SELECT statement clause can be used with the JOIN keyword to perform a natural join but limit the columns for the join condition?
a USING clause
Which of the following is used to convert a number to a character value?
TO_CHAR
The <> (not equal) comparison operator can only be used with which type of subquery?
a single-row subquery
The SUBSTR character function replaces a portion of a string, beginning at a defined character position for a defined length - True or False ?
1
INSTR()
I

The INSTR functions search string for substring. The search operation is defined as comparing the substring argument with substrings of string of the same length for equality until a match is found or there are no more substrings left. Each consecutive compared substring of string begins one character to the right (for forward searches) or one character to the left (for backward searches) from the first character of the previous compared substring. If a substring that is equal to substring is found, then the function returns an integer indicating the position of the first character of this substring. If no such substring is found, then the function returns zero.

■ position is an nonzero integer indicating the character of string where Oracle Database begins the search—that is, the position of the first character of the first substring to compare with substring. If position is negative, then Oracle
counts backward from the end of string and then searches backward from the resulting position.

■ occurrence is an integer indicating which occurrence of substring in string Oracle should search for. The value of occurrence must be positive. If occurrence is greater than 1, then the database does not return on the first match
but continues comparing consecutive substrings of string, as described above, until match number occurrence has been found. INSTR accepts and returns positions in characters as defined by the input character set, with the first character of string having position 1. INSTRB uses bytes instead of characters. INSTRC uses Unicode complete characters. INSTR2 uses UCS2 code
points. INSTR4 uses UCS4 code points.

string can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or
NCLOB. The exceptions are INSTRC, INSTR2, and INSTR4, which do not allow string to be a CLOB or NCLOB.

substring can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB.

The value returned is of NUMBER data type.
Both position and occurrence must be of data type NUMBER, or any data type that can be implicitly converted to NUMBER, and must resolve to an integer. The default values of both position and occurrence are 1, meaning Oracle begins searching at the first character of string for the first occurrence of substring. The return value
is relative to the beginning of string, regardless of the value of position.

The following example searches the string CORPORATE FLOOR, beginning with the third character, for the string "OR". It returns the position in CORPORATE FLOOR at which the second occurrence of "OR" begins:

SELECT INSTR('CORPORATE FLOOR','OR', 3, 2) "Instring" FROM DUAL;

Instring
----------
14

In the next example, Oracle counts backward from the last character to the third haracter from the end, which is the first O in FLOOR. Oracle then searches backward for the second occurrence of OR, and finds that this second occurrence begins with the second character in the search string :

SELECT INSTR('CORPORATE FLOOR','OR', -3, 2) "Reversed Instring" FROM DUAL;

Reversed Instring
-----------------
2

The next example assumes a double-byte database character set.

SELECT INSTRB('CORPORATE FLOOR','OR',5,2) "Instring in bytes" FROM DUAL;

Instring in bytes
-----------------
27
CURRVAL is used to refer to the last sequence number that has been generated - Correct or Incorrect about Sequences created in a single instance database ?
Correct
Which privilege is an object privilege?
INDEX
B-tree indexes are not able to support SQL queries using Oracle's built-in functions - Correct or Incorrect about B-Tree Index ?
Correct
Consider this statement: create table t1 as select * from regions where 1=2; What will be the result?
The table T1 will be created but no rows inserted because the condition returns FALSE
For the statement SELECT * FROM emp WHERE dept_id = (SELECT id FROM dept WHERE dept_name = 'ACCTG'); to execute properly, how many id values should the subquery return?
one
Which functions compute an aggregate value based on a group of rows?
Analytic function
Rows can be deleted even if they do not match the join condition for merging - Correct or Incorrect about MERGE statement ?
Incorrect
SELECT is different from select - Correct or Incorrect about SELECT statement ?
Incorrect
They are Read-Only tables and DML operations are not allowed on them - Correct or Incorrect about EXTERNAL tables ?
Correct
TRUNCATE can drop the storage being used by the table - Correct or Incorrect ?
Correct
You need to get information about columns in a table you do not own, nor do you have privileges to it. Which view can you query to get this information?
DBA_TAB_COLUMNS
Which statements is used to add rows to a table or to the base table of a view?
INSERT
You work as a Database Administrator for Gadgets Inc. The company uses Oracle as its
database. You have used the hierarchical tree concept to manage hierarchies in the company.

Which of the following clauses can be used to identify hierarchical queries?

Each correct answer represents a complete solution. Choose two.

A: WHERE
B: WITH
C: START WITH
D: CONNECT BY
C: START WITH
D: CONNECT BY
Review the following table named Employee:

Name Null ? Type
Emp_id Not Null NUMBER (3)
Dept_id Not Null NUMBER (3)
Emp_Address Not Null VARCHAR2(30)
Join_date Not Null Date

You have written the following SQL statement:

SELECT Emp_id, Dept_id
FROM Employee
WHERE Join_date >'March 30 2000';

Which of the following statements is true regarding the execution of the above SQL
statement?

A: It would not execute because 'March 30 2000' in the WHERE clause cannot be converted implicitly and needs the use of the TO_DATE conversion function for proper execution.

B: It would not execute because 'March 30 2000' in the WHERE clause cannot be converted implicitly and needs the use of the TO_CHAR conversion function for proper execution.

C: It will not execute because 'March 30 2000' in the WHERE clause is not enclosed in double quotation marks.

D: It would execute and would return Emp_id and Dept_id for all records having Join_date greater than 'March 30 2000'.
A: It would not execute because 'March 30 2000' in the WHERE clause cannot be converted implicitly and needs the use of the TO_DATE conversion function for
proper execution.
Evaluate the following SQL statement:

SQL > SELECT Promo_ID, Promo_Category
FROM Promotions Where Promo_Category = 'Chair' ORDER BY 2 DESC
UNION
SELECT Promo_ID, Promo_Category
FROM Promotions WHERE Promo_Category='Refrigerator'
UNION
SELECT Promo_ID, Promo_Category
FROM Promotions WHERE Promo_Category='Radio';

Which of the following statements is true regarding the outcome of the above query?

A: It executes successfully, but ignores the ORDER BY clause because it is not located
at the end of the compound statement.

B: It executes successfully and displays rows in the descending order of Promo_Category.

C: It executes successfully and after that deletes
the Promotions table.

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.
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
NEW_TIME()
NEW_TIME returns the date and time in time zone timezone2 when date and time in time zone timezone1 are date. Before using this function, you must set the NLS_DATE_FORMAT parameter to display 24-hour time. The return type is always DATE, regardless of the data type of date.
Which clauses is used to sort the output of a query?
ORDER BY
You need to remove from the ORDER_ITEMS table those rows that have an order status of 0 or 1 in the ORDERS table.

Which DELETE statements are valid? (Choose all that apply.)

A. DELETE
FROM order_items
WHERE order_id IN (SELECT order_id FROM orders
WHERE order_status in (0,1));

B. DELETE *
FROM order_items
WHERE order_id IN (SELECT order_id FROM orders
WHERE order_status IN (0,1));

C. DELETE FROM order_items i
WHERE order_id = (SELECT order_id FROM orders o
WHERE i. order_id = o. order_id AND
order_status IN (0,1));

D. DELETE
FROM (SELECT* FROM order_items i.orders o
WHERE i.order_id = o.order_id AND order_status IN (0,1));
A,C,D
GROUP BY can be used without group functions - Correct or Incorrect ?
Correct
The HAVING clause conditions can have aggregate functions - Correct or Incorrect ?
Correct
Which of the following queries will provide EMPID and SAL of the employee earning the
maximum salary?

A: SELECT EMPID, SAL FROM EMP WHERE SAL=(SELECT MAX (SAL) FROM EMP);

B: SELECT EMPID, SAL FROM EMP WHERE SAL=MAX (SAL);

C: SELECT EMPID, SAL FROM EMP;

D: SELECT EMPID, SAL FROM EMP HAVING SAL=MAX (SAL);
A: SELECT EMPID, SAL FROM EMP WHERE SAL=
(SELECT MAX (SAL) FROM EMP);
When performing a multitable INSERT, what two properties about the columns in the subquery and the columns in the outer query must match?
they must be equal in number and in datatype
Consider that you have a table EMP with details of all the Employees (EMPNO), their managers (MGR) and their departments (DEPTNO). You want to insert the EMPNO and MGR information into two other separate tables viz. EMPLOYEES and MANAGERS for Department number 30 only.

Which of the following SQL statements should you write to do the same?

Each correct answer represents a complete solution. Choose all that apply.

A: INSERT ALL
WHEN DEPTNO = 30 THEN
INTO EMPLOYEES VALUES (EMPNO)
INTO MANAGERS VALUES (MGR)
SELECT EMPNO, MGR, DEPTNO
FROM EMP WHERE DEPTNO=30;

B: INSERT ALL
INTO EMPLOYEES VALUES (EMPNO)
INTO MANAGERS VALUES (MGR)
SELECT EMPNO, MGR, DEPTNO
FROM EMP WHERE DEPTNO=30;

C: INSERT FIRST
WHEN DEPTNO = 30 THEN
INTO EMPLOYEES VALUES (EMPNO)
INTO MANAGERS VALUES (MGR)
SELECT EMPNO, MGR, DEPTNO
FROM EMP;

D: INSERT ALL
WHEN DEPTNO = 30 THEN
INTO EMPLOYEES VALUES (EMPNO)
INTO MANAGERS VALUES (MGR)
SELECT EMPNO, MGR, DEPTNO
FROM EMP;
A: INSERT ALL
WHEN DEPTNO = 30 THEN
INTO EMPLOYEES VALUES (EMPNO)
INTO MANAGERS VALUES (MGR)
SELECT EMPNO, MGR, DEPTNO
FROM EMP WHERE DEPTNO=30;

B: INSERT ALL
INTO EMPLOYEES VALUES (EMPNO)
INTO MANAGERS VALUES (MGR)
SELECT EMPNO, MGR, DEPTNO
FROM EMP WHERE DEPTNO=30;

C: INSERT FIRST
WHEN DEPTNO = 30 THEN
INTO EMPLOYEES VALUES (EMPNO)
INTO MANAGERS VALUES (MGR)
SELECT EMPNO, MGR, DEPTNO
FROM EMP;

D: INSERT ALL
WHEN DEPTNO = 30 THEN
INTO EMPLOYEES VALUES (EMPNO)
INTO MANAGERS VALUES (MGR)
SELECT EMPNO, MGR, DEPTNO
FROM EMP;
A NATURAL JOIN can be used for self joins - Correct or Incorrect about Self-Joins ?
Correct
What is the default display length of the DATE datatype?
9
Which type of join is represented by the use of an operator other than an equality operator (=)?
a non-equijoin
Which of the following functions can be used to differentiate between even and odd numbers?
MOD
To identify a root node, you must:
Use the START WITH clause to identify a row.
Multiple-column subqueries are often used as data sources in which clause of an outer SELECT statement?
the FROM clause
A number value may be converted to a character string using the TO_CHAR function - True or False ?
1
Which types of index would you use to avoid large sorting operations, such as a SQL query that requires 10,000 rows to be presented in sorted order?
B-tree indexes
The database records both the grantor and grantee for system privileges - Correct or Incorrect about System Privileges ?
Incorrect
A view can be dropped and then re-created - Correct or Incorrect about a VIEW ?
Correct
GRANT ALL ON Sales, Orders TO PUBLIC; What will you do to correct the above statement?
Separate GRANT statements are required for Sales and Orders tables
If an INSERT statement has a subquery instead of a VALUES clause, what criterion will allow the statement to execute successfully relative to the INSERT and the SELECT?
The number and datatype of the columns returned by the SELECT must match the number and datatype of columns the INSERT is expecting.
Single Row Functions can be used in SELECT, WHERE, and ORDER BY clauses. - True or False ?
1
Which of the following is used to execute a SQL statement?
back slash (), Semicolon (;)
In order to issue a TRUNCATE TABLE statement successfully, you must either own the table or have which privilege?
the DROP ANY TABLE system privilege
It would not remove the rows if the table has a primary key - Correct or Incorrect about DELETE FROM statements ?
Incorrect
The term “metadata” means:
Data about data
Which statements does indicate the end of a transaction?
After a COMMIT is issued / After a CREATE statement is issued / After a ROLLBACK is issued
You have a table called CUSTOMERS, and you want to change the name of a column in the CUSTOMERS table from NAME to LAST_NAME. Which statements could you use?
ALTER TABLE CUSTOMERS RENAME COLUMN NAME TO LASTNAME
View the Exhibit and examine the description of the CUSTOMERS table.

You want to add a constraint on the CUST_FIRST_NAME column of the CUSTOMERS table so that the value inserted in the column does not have numbers.

Which SOL statement would you use to accomplish the task?

A. ALTER TABLE CUSTOMERS
ADD CONSTRAINT cust_f_name
CHECK(REGEXP_LIKE(cust_first_name1'^A-Z '))NOVALIDATE;

B. ALTER TABLE CUSTOMERS
ADD CONSTRAINT cust_f_name
CHECK(REGEXP_LIKE(cust_first_name,'^[0-9]'))NOVALIDATE;

C. ALTER TABLE CUSTOMERS
ADD CONSTRAINT cust_f_name
CHECK(REGEXP_LIKE(cust_first_name,'[[:alpha: ]]'))NOVALIDATE;

D. ALTER TABLE CUSTOMERS
ADD CONSTRAINT cust_f_name
CHECK(REGEXP_LIKE(cust_first_name,'[[:digit: ]]'))NOVALIDATE ;
C
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its
database. You have passed the value "Learning" to the database. Which of the following data types will trim the insignificant trailing spaces before the string is stored in the database?

A: CHARACTER
B: VARCHAR2
C: VARCHAR
D: CHAR
B: VARCHAR2
LOWER()
LOWER returns char, with all letters lowercase. char can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The return value is the same data type as char. The database sets the case of the characters based on the binary mapping defined for the underlying character set.

The following example returns a string in lowercase:

SELECT LOWER('MR. SCOTT MCMILLAN') "Lowercase" FROM DUAL;

Lowercase
--------------------
mr. scott mcmillan
You are the DBA for an insurance company, and are required to maintain data about the agents hired, insurance policies offered, and the policies sold by the company. As recognition to the agents who have sold 100 or more policies total to date, the company decides to increase their commission by 50% of their current commission.

A table called agents contains one row for each agent in the company.

SQL> desc agents

Name Type
--------------------------------
agent_id NUMBER(3)
agent_name VARCHAR2(25)
commission NUMBER(5,1)

A table called sold_policies contains one row for each policy sold.

SQL> desc sold_policies

Name Type
----------------------------------
policy_id NUMBER(3)
agent_id NUMBER(3)
policy_holder VARCHAR2(25)

Which of the following statements should you use to update the appropriate commissions?

UPDATE agents SET commission=1.5*commission
WHERE agent_id IN (SELECT agent_id AS PolicySold FROM sold_policies WHERE SUM(policy_id) >100;

UPDATE agents SET commission=1.5*commission
WHERE agent_id IN (SELECT agent_id AS PolicySold FROM sold_policies
GROUP BY agent_id);

UPDATE agents SET commission=1.5*commission
WHERE agent_id IN (SELECT agent_id AS PolicySold FROM sold_policies
GROUP BY agent_id
HAVING SUM(policy_id)>=100);

UPDATE agents SET commission=1.5*commission
WHERE agent_id IN (SELECT agent_id AS PolicySold FROM sold_policies GROUP BY agent_id HAVING COUNT (agent_id ) > 100;
UPDATE agents SET commission=1.5*commission
WHERE agent_id IN (SELECT agent_id AS PolicySold
FROM sold_policies GROUP BY agent_id
HAVING COUNT (agent_id ) > 100;
The WHERE and HAVING clauses cannot be used together in a SQL statement - Correct or Incorrect ?
Incorrect
Group Functions can be used only with a SQL statement that has the GROUP BY clause - Correct or Incorrect ?
Incorrect
Which of the following SQL statements will generate an ORA error?

A: SELECT NVL(null,1234) FROM DUAL;

B: SELECT NVL(1234) FROM DUAL;

C: SELECT NVL(INSTR('1#2#3#4#5#','#',11), 'The # symbol not found') FROM DUAL;

D: SELECT NVL(SUBSTR('abc',4), 'No such substring found') FROM DUAL;
B: SELECT NVL(1234) FROM DUAL
You want to display only the rows that have 'harddisks' as part of the string in the Description column of the COMPONENT table. Which WHERE clause options can give you the desired result?
WHERE REGEXP_LIKE (Description, '^H|hard+.s'); / WHERE REGEXP_LIKE (Description, '^H|hard*.s'); / WHERE REGEXP_LIKE (Description, 'hard+.s');
You work as a Database Technical support for Dolliver Inc. The company uses Oracle
11g as its database. The database has a table named Employee. One of your clients
wants to know which function he should use to show the average age of employees as
42.4 instead of 42.39 in the Age column of the table.

Which of the following functions will you suggest him to use?

A: TRUNC(42.39,1)
B: MOD(42.39,1)
C: ROUND(42.39,1)
D: CEIL(42.39)
C: ROUND(42.39,1)
If the subquery returns more than one row, then the value is considered to be NULL - Correct or Incorrect about Scaler Subquery ?
Incorrect
In the PRD database there is a SALES table and there is a SALES_HISTORY table. The SALES table holds data for the current month and SALES_HISTORY table holds data for
previous months, i.e. archived data. Every month data is moved from the SALES to SALES_HISTORY table. For the current month, there are some data related issues in the SALES table that need to be corrected using the archived data in the SALES_HISTORY.

Which type of query is best suited for this situation if you want to update the SALES table data with relevant data from the SALES_HISTORY table based on a common key
column?

A: Inline view
B: Nested sub-query
C: Correlated sub-query
D: Joins
C: Correlated sub-query
If the column order_date has a datatype of date, what would be the value of order_date + 7?
Exactly one week after the order date, at the same time of day.
When using Oracle proprietary join syntax, what operator would you use in a WHERE clause to produce an outer join?
(+)
What keyword(s) in a SQL SELECT can be used instead of the keyword CUBE in order to calculate just the aggregations you need from the GROUP BY clause?
GROUPING SETS
A subquery that returns a single row of data is known as which type of subquery?
a single-row subquery
Indexes should be created on columns that are frequently referenced as part of any expression - Correct or Incorrect about Indexes ?
Incorrect
The LENGTH character function returns the number of characters in an expression - True or False ?
1
To provide values for conditions in a WHERE clause, HAVING clause, or START WITH clause of SELECT, UPDATE, and DELETE statements - True or False regarding the Use of Subquery ?
1
System privileges are required to implement the revoke cascades - Correct or Incorrect about System Privileges ?
Incorrect
SQL Subquery is used when two or more queries need to be executed and put together to reach a desired result - True or False ?
1
Synonyms can be created both for tables as well as for views - Correct or Incorrect about Synonyms ?
Correct
If user SCOTT wants to grant UPDATE rights on the EMP table to user BLAKE and also enable him to grant this privilege to other users, which option should SCOTT use in the grant statement to accomplish this?
WITH GRANT OPTION;
A non-deferrable PRIMARY KEY or UNIQUE KEY constraint in a table automatically creates a unique index - Correct or Incorrect about Indexes ?
Correct
SELECT NVL(null,1234) FROM DUAL; - Correct or Incorrect ?
Correct
A SELECT that draws data from two or more tables by relating common information between them is said to be doing which of the following?
Joining
If no schema is explicitly included in a CREATE TABLE statement, where is the table created?
in the current user's schema
The EXISTS condition can be used in select, insert, update, or delete SQL statement - Correct or Incorrect ?
Correct
Which data dictionary view could you query to display the names of tables you have access to?
ALL_OBJECTS
Types of DML statements are --
DELETE / UPDATE / INSERT
Which commands is used to drop a constraint by using the DROP CONSTRAINT clause?
ALTER TABLE
Oracle automatically maintains and uses indexes after they are created - Correct or Incorrect about Indexes in Oracle ?
Correct
Which of the following conditions would allow a user to grant SELECT privileges on the customer table to everyone using the PUBLIC keyword?

The user owns the customer table.

The user has been granted the PUBLIC privilege.

The user has SELECT privileges on the customer table.

The user has been granted the SELECT privilege with the PUBLIC OPTION
The user owns the customer table
Evaluate the CREATE TABLE statement:

CREATE TABLE products
(product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY,
product_name VARCHAR2(15));

Which statement is true regarding the PROD_ID_PK constraint?

A. It would be created only if a unique index is
manually created first.

B. It would be created and would use an automatically created unique index.

C. It would be created and would use an automatically created nonunique index.

D. It would be created and remains in a disabled state because no index is specified in the
command.
B
TRANSLATE()
TRANSLATE()

TRANSLATE returns expr with all occurrences of each character in from_string replaced by its corresponding character in to_string. Characters in expr that are not in from_string are not replaced. The argument from_string can contain more characters than to_string. In this case, the extra characters at the end of from_string have no corresponding characters in to_string. If these extra characters appear in expr, then they are removed from the return value.

If a character appears multiple times in from_string, then the to_string mapping
corresponding to the first occurrence is used.
You cannot use an empty string for to_string to remove all characters in from_string from the return value. Oracle Database interprets the empty string as null, and if this function has a null argument, then it returns null. To remove all characters in from_string, concatenate another character to the beginning of from_string
and specify this character as the to_string.

TRANSLATE provides functionality related to that provided by the REPLACE function.

REPLACE lets you substitute a single string for another single string, as well as remove
character strings. TRANSLATE lets you make several single-character, one-to-one
substitutions in one operation.

This function does not support CLOB data directly. However, CLOBs can be passed in
as arguments through implicit data conversion.

The following statement translates a book title into a string that could be used (for example) as a filename. The from_string contains four characters: a space, asterisk,slash, and apostrophe (with an extra apostrophe as the escape character). The to_string contains only three underscores. This leaves the fourth character in the from_string without a corresponding replacement, so apostrophes are dropped from thereturned value.

SELECT TRANSLATE('SQL*Plus User''s Guide', ' */''', '___') FROM DUAL;

TRANSLATE('SQL*PLUSU
--------------------
SQL_Plus_Users_Guide
View the Exhibit and examine the data in EMPLOYEES and DEPARTMENTS tables. In the EMPLOYEES table EMPLOYEE_ID is the PRIMARY KEY and DEPARTMENT_ID is the FOREIGN KEY. In the DEPARTMENTS table DEPARTMENT_ID is the PRIMARY KEY.

Evaluate the following UPDATE statement:

UPDATE employees a
SET department_jd =
(SELECT department_id
FROM departments
WHERE location_id = '2100'),
(salary, commission_pct) =
(SELECT 1.1*AVG(salary), 1.5*AVG(commission_pct)
FROM employees b
WHERE a. department_jd = b. department_id)
WHERE first_name|| '||last_name = 'Amit Banda';

What would be the outcome of the above statement?

A. It would execute successfully and update the relevant data.

B. It would not execute successfully because there is no LOCATION_ID 2100 in the DEPARTMENTS table.

C. It would not execute successfully because the condition specified with the concatenation
operator is not valid.

D. It would not execute successfully because multiple columns (SALARY,COMMISSION_PCT)cannot be used in an UPDATE statement
A
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. The database contains a table named Cudtomers. You want to retrieve customer_id, customer_name, and customer_phone from the table. You also want to display a message 'no contact number is available', if a customer has not provided any contact number.

Which of the following SQL queries will you use to accomplish the task?

A: SELECT customer_id, customer_name, NVL(customer_phone, "no contact is
available") AS CONTACT FROM customers;

B: SELECT customer_id, customer_name, NVL("no contact is available") AS CONTACT
FROM customers;

C: SELECT customer_id, customer_name, NVL(customer_phone, 'no contact is
available') AS CONTACT FROM customers;

D: SELECT customer_id, customer_name, NVL('no contact is available') AS CONTACT
FROM customers;
C: SELECT customer_id, customer_name, NVL(customer_phone, 'no contact is
available') AS CONTACT FROM customers;
The HAVING clause is used to exclude one or more aggregated results after grouping data - Correct or Incorrect ?
Correct
View the Exhibit and examine the structure of the ORDERS table.

NEWJDRDERS is a new table with the columns ORD_ID, ORD_DATE, CUST_ID, and
ORD_TOTAL that have the same data types and size as the corresponding columns in the
ORDERS table.

Evaluate the following INSERT statement:

INSERT INTO new_orders (ord_id, ord_date, cust_id, ord_total) VALUES(SELECT
order_id.order_date.customer_id.order_total FROM orders WHERE order_date > '31-dec-1999');

Why would the INSERT statement fail?

A. because column names in NEW_ODRDERS and ORDERS tables do not match

B. because the VALUES clause cannot be used in an INSERT with a subquery

C. because the WHERE clause cannot be used in a subquery embedded in an INSERT statement

D. because the total number of columns in the NEW ORDERS table does not match the total
number of columns in the ORDERS table
B
Which patterns, if used in a CHECK constraint, will ensure that incoming data to a column will be accepted if it starts with the word “buy” or starts with the word “sell”, and that anything else will be rejected?
'^(buy|sell)'
The student table contains these columns:

stu_id NUMBER(9) NOT NULL
last_name VARCHAR2(30) NOT NULL
first_name VARCHAR2(25) NOT NULL
dob DATE
stu_type_id VARCHAR2(1) NOT NULL
enroll_date DATE

You create another table, named pt_student, with an identical structure. You want to insert all part-time students, who have a stu_type_id value of P, into the new table. You execute this INSERT statement:

SQL> INSERT INTO pt_student
(SELECT stu_id, last_name, first_name, dob, sysdate FROM student
WHERE UPPER(stu_type_id) = 'P');

What is the result of executing this INSERT statement?

All part-time students are inserted into the pt_student table.

An error occurs because the pt_student table already exists.

An error occurs because you cannot use a subquery in an INSERT statement.

An error occurs because the INSERT statement does not contain a VALUES clause.

An error occurs because the stu_type_id column is not included in the subquery select list.

An error occurs because both the stu_type_id and enroll_date columns are not included in the
subquery select list
An error occurs because the stu_type_id column is not included in the subquery select list.
The parent query is executed for each of the rows returned by the subquery - Correct or Incorrect about Correlated Subquery ?
Incorrect
There are three tables named EMP, DEPT and SALGRADE in the PROD database. EMP
has 14 rows, DEPT has 4 rows and SALGRADE has 5 rows. There are 7 rows in the EMP
table where a column has NULL values.

If a Cartesian product is generated by joining EMP, DEPT and SALGRADE tables, how
many rows will be returned in the final result set?

A: 140
B: 23
C: 16
D: 280
D: 280
Which may be used within a parameter of the REGEXP_LIKE function?
‘[:alpha:]’ / ‘*’ as a regular expression operator / ‘%’ as a literal value
Which clauses is contained by most join queries that compares two columns, each from a different table?
WHERE
What are the ways in which Oracle processes a hierarchical query?
JOIN / CONNECT BY condition / WHERE clause predicate
Which option of the CREATE SEQUENCE statement allows the sequence to continue to generate values after the maximum sequence value has already been generated?
the CYCLE option
Which query returns an expression of the datatype INTERVAL YEAR TO MONTHS representing an interval of 1 year and 3 months?
SELECT TO_YMINTERVAL(‘01-03’) FROM DUAL;
The hierarchical query pseudocolumns are --
CONNECT_BY_ISCYCLE / CONNECT_BY_ISLEAF / LEVEL
A subquery can be used in the SET clause of an UPDATE statement, regardless of the number of rows it returns - True or False regarding Subquery ?
1
SQL subquery can be used with SELECT statements only - True or False ?
1
For which of the following database objects can you create a synonym?
Views / Stored procedure / Java class schema object / Another synonym
A number value may be converted to a character value using the TO_NUMBER function- True or False ?
1
Andrew creates an account named Sales . He wants to lock the Sales account to ensure that no one is able to connect to the database by using this account. Which statements accomplish the task?
ALTER USER Sales ACCOUNT LOCK;
Which is a view of a user-defined type, where each row contains objects, each object with a unique object identifier?
Object view
Which privilege can be granted to a user and as well as to a role?
ALTER / DELETE / INSERT / EXECUTE
What is the result of 3 + 2 * 5?
13. Multiplication has higher precedence than addition, so 2 * 5 is evaluated first.
Data file - IS IT A Database Object ? - Yes or No
NO
The EXISTS condition is considered to be fulfilled if the subquery returns at least one row - Correct or Incorrect ?
Correct
What valid character does Oracle recommend you NOT use for table names?
The $ character. Because data dictionary tables contain a $ character, using $ in a table name makes it hard to distinguish between a data dictionary object and a user-created object.
An INSERT statement can be used to:
Create rows of data in a table.
Which operations CANNOT be undone by the FLASHBACK statement?
TRUNCATE TABLE Employees / DROP TABLE Employees PURGE; / ALTER TABLE Employees ADD CONSTRAINT empcheck CHECK (Salary>1000);
What two constraints, when created, also cause an index to be created?
PRIMARY KEY and UNIQUE
Which statements correctly tells the usage of the V$ dynamic performance views?
These views are used to monitor real time database statistics.
SYS_CONNECT_BY_PATH()
SYS_CONNECT_BY_PATH()

SYS_CONNECT_BY_PATH is valid only in hierarchical queries. It returns the path of a
column value from root to node, with column values separated by char for each row returned by CONNECT BY condition.

Both column and char can be any of the data types CHAR, VARCHAR2, NCHAR, or
NVARCHAR2. The string returned is of VARCHAR2 data type and is in the same
character set as column.
Evaluate the following expression using meta character for regular expression:

'[^Ale|ax.r$]'

Which matches would be returned by this expression?

Each correct answer represents a complete solution. Choose two.

A: Alxer
B: Alaxendar
C: Alex
D: Alax
E: Alexender
B: Alaxendar

E: Alexender
The query should display the employee IDs of all the employees who have held the job SA_MAN at any time during their tenure.

Choose the correct SET operator to fill in the blank space and complete the following query.

SELECT employee_id
FROM employees
WHERE job_id = 'SA_MAN'
________________

SELECT employee_id
FROMjob_history
WHERE job_id='SA_MAN'

A. UNION
B. MINUS
C. INTERSECT
D. UNION ALL
A,D
Which of the following subqueries is used when a user wants to display all rows where
there is a matching column in both tables?

A: WHERE COLUMN <
B: WHERE FOUND
C: WHERE COLUMN >
D: WHERE EXISTS
D: WHERE EXISTS
Meta Character Matches one of the character, such as the OR operator --
|
You work as a Database Administrator for Bell Solutions Inc. The company uses Oracle
as its database. You grant the CREATE VIEW privilege to a database user named John.

Which of the following operations is John able to perform?

A: Create a view accessed by anyone.
B: Create a view in his own schema.
C: Create a view accessed by him only.
D: Create a view in any schema
B: Create a view in his own schema
If the subquery returns 0 rows, then the value of the scalar subquery expression is NULL - Correct or Incorrect about Scaler subquery ?
Correct
Which of the following mandatory clauses should be added to statement given below to
successfully create an external table called Emp?

CREATE TABLE Emp
(empno NUMBER(2), ename CHAR(5), depno NUMBER(4))
ORGANIZATION EXTERNAL
(LOCATION ('Emp.dat'));

A: DIFFERENCE LIMIT
B: DEFAULT DIRECTORY
C: ACCESS PARAMETERS
D: TYPE
B: DEFAULT DIRECTORY
Susan maintains the database for a library. She needs to find the number of all the books that have the word Database in their titles. Which of the following functions should you use in this scenario?
REGEXP_COUNT
Which group function calculates the average of a group of values?
AVG
You need to create a report to display the names of customers with a credit limit greater than the average credit limit of all customers.

Which SELECT statement should you use?

SELECT last_name, first_name
FROM customer
WHERE credit_limit > AVG(credit_limit);

SELECT last_name, first_name, AVG(credit_limit)
FROM customer
GROUP BY AVG(credit_limit);

SELECT last_name, first_name, AVG(credit_limit)
FROM customer
GROUP BY AVG(credit_limit)
HAVING credit_limit > AVG(credit_limit);

SELECT last_name, first_name
FROM customer
WHERE credit_limit > (SELECT AVG(credit_limit)
FROM customer);

SELECT last_name, first_name
FROM customer
WHERE credit_limit = (SELECT AVG(credit_limit)
FROM customer);
SELECT last_name, first_name
FROM customer
WHERE credit_limit > (SELECT AVG(credit_limit)
FROM customer);
Which functions should you use to display the hierarchical data in a readable format for reporting purposes?
LPAD
Which option of a CREATE VIEW statement creates the view regardless of whether the underlying tables exist?
the FORCE option
View the Exhibit and examine the description of the ORDERS table.

Evaluate the following SQL statement:

SELECT order_id, customer_id
FROM orders WHERE order_date > 'June 30 2001';

Which statement is true regarding the execution of this SQL statement?

A. It would not execute because 'June 30 2001' in the WHERE condition is not enclosed within
double quotation marks.

B. It would execute and would return ORDER_ID and CUSTOMER_ID for all records having
ORDER_DATE greater than 'June 30 2001'.

C. It would not execute because 'June 30 2001' in the WHERE condition cannot be converted
implicitly and needs the use of the TO_DATE conversion function for proper execution.

D. It would not execute because 'June 30 2001' in the WHERE condition cannot be converted
implicitly and needs the use of the TO_CHAR conversion function for proper execution.
C
The earliest ancestor in a hierarchy is known as the:
Root node
It is used to form the group sets involved in generating the totals and subtotals - Correct or Incorrect about GROUPING function ?
Incorrect
A subquery used with the IN operator must return multiple rows - True or False regarding subquery ?
1
Multiple-row subqueries can contain group functions - True or False ?
1
Which three functions can be used to manipulate character column values?
RPAD, INSTR, CONCAT
Which will be generated by CUBE and ROLLUP for each dimension at the subtotal levels?
NULL value
CREATE ROLE emp - Correct or Incorrect ?
Correct
Which views should a user use to show all the tables in a database?
DBA_TABLES
Roles are not contained in any schema - Correct or Incorrect about ROLES ?
Correct
Provides efficient linguistic collation to use NLS sort index - Correct or Incorrect about Indexes ?
Correct
Which datatype stores a length of time in months and years?
INTERVAL YEAR TO MONTH
The WITH clause is part of the SQL-99 standard and was added into the Oracle SQL syntax in Oracle 9.2 - Correct or Incorrect ?
Correct
Which type of constraint enforces a relationship between the column and another column in the same or a different table?
FOREIGN KEY
Which construct specifies a different heading for a column in a SELECT list?
a column alias
Which system privileges should you have to create function-based indexes on tables in other schema?
Global query rewrite
Will the query SELECT * FROM emp WHERE salary = commission; display rows in which the salary and the commission are both NULL?
No
Which ALTER TABLE statement should you use to add a PRIMARY KEY constraint on the manufacturer_id column of the inventory table?

ALTER TABLE inventory
ADD PRIMARY KEY (manufacturer_id);

ALTER TABLE inventory
ADD CONSTRAINT manufacturer_id PRIMARY KEY;

ALTER TABLE inventory
MODIFY manufacturer_id CONSTRAINT PRIMARY KEY;

ALTER TABLE inventory
MODIFY CONSTRAINT PRIMARY KEY manufacturer_id;
ALTER TABLE inventory
ADD PRIMARY KEY (manufacturer_id);
Which of the following flashback features is used to see all the changes made by a specific transaction and is useful when an erroneous transaction has changed data in multiple rows or tables?
Flashback Transaction Query
Which clause in a MERGE statement precedes the INSERT statement?
WHEN NOT MATCHED THEN
You want to display the CUSTOMER_ID, PRODUCT_ID, and total (UNIT_PRICE multiplied by
QUANTITY) for the order placed. You also want to display the subtotals for a CUSTOMER_ID as
well as for a PRODUCT ID for the last six months.

A. SELECT o.customer_Id, oi.productj_id, SUM(oi.unit_price*oi. quantity) "Total" FROM order_items oi JOIN orders o
ON oi.order_id=o.order_id
GROUP BY ROLLUP (o.customer_id.oi.product_id)
WHERE MONTHS_BETWEEN(order_date, SYSDATE) <= 6;

B. SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi. quantity) "Total" FROM orderjtems oi JOIN orders o
ON oi.order_id=o.order_id
GROUP BY ROLLUP (o.customer_id.oi.product_id)
HAVING MONTHS_BETWEEN(order_date, SYSDATE) <= 6;

C. SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" FROM order_items oi JOIN orders o ON oi.order_id=o.order_id
GROUP BY ROLLUP (o.customer_id, oi.product_id)
WHERE MONTHS_BETWEEN(order_date, SYSDATE) >= 6;

D. SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" FROM order_items oi JOIN orders o ON oi.order_id=o.order_id
WHERE MONTHS_BETWEEN(order_date, SYSDATE) <= 6
GROUP BY ROLLUP (o.customer_id, oi.product_id);
D
User Marilyn wants to eliminate the need to type the full table name when querying the transaction_history table in her schema. All other database users should use the schema and full table name when referencing this table.

Which statement should user Marilyn execute?

CREATE SYNONYM trans_hist
FOR transaction_history;

CREATE PUBLIC SYNONYM trans_hist
FOR marilyn;

CREATE PUBLIC trans_hist SYNONYM
FOR marilyn.transaction_history;

CREATE PRIVATE SYNONYM trans_hist
FOR marilyn.transaction_history;
CREATE SYNONYM trans_hist
FOR transaction_history;
EMP is an external table that contains a column called EMPNO and EMPNAME.

Which command would work in relation to the EMP table?

A: UPDATE EMP
SET EMPNAME='ROBERT'
where EMPNO='1234';

B: CREATE index emp_index
ON EMP (EMPNO);

C: INSERT INTO EMP ("EMP_PH", "EMP_AGE" )
VALUES (9854765758, 45);

D: CREATE view emp_view
AS
SELECT * FROM EMP;
D: CREATE view emp_view
AS
SELECT * FROM EMP;
LOCALTIMESTAMP()
LOCALTIMESTAMP returns the current date and time in the session time zone in a value of data type TIMESTAMP. The difference between this function and CURRENT_TIMESTAMP is that LOCALTIMESTAMP returns a TIMESTAMP value while CURRENT_TIMESTAMP returns a TIMESTAMP WITH TIME ZONE value.

The optional argument timestamp_precision specifies the fractional second precision of the time value returned.
A correlated subquery may be used in:
The SET clause of an UPDATE statement / The WHERE clause of an UPDATE statement / The WHERE clause of a DELETE statement
Which of the following options will return the same result set as of the join query given below?

SELECT E.EMPNO, E.ENAME, E.SAL
FROM EMP E, DEPT D
WHERE E.DEPTNO=D.DEPTNO
AND D.DNAME='SALES';

A: SELECT EMPNO, ENAME, SAL
FROM EMP
WHERE DEPTNO=(SELECT D.DEPTNO FROM DEPT D) AND DNAME='SALES';

B: SELECT E.EMPNO, E.ENAME, E.SAL
FROM EMP E
WHERE E.DEPTNO=(SELECT D.DEPTNO FROM DEPT D WHERE
E.DEPTNO=D.DEPTNO);

C: SELECT EMPNO, ENAME, SAL
FROM EMP
WHERE DEPTNO=(SELECT D.DEPTNO FROM DEPT D WHERE D.DNAME='SALES');

D: SELECT EMPNO, ENAME, SAL
FROM EMP
WHERE DEPTNO=(SELECT D.DEPTNO FROM DEPT D);
C: SELECT EMPNO, ENAME, SAL
FROM EMP
WHERE DEPTNO=(SELECT D.DEPTNO FROM DEPT D WHERE D.DNAME='SALES');
Which regular expression functions searches a given pattern in the source string and replaces it with the other specified string?
REGEXP_REPLACE
The ORDER BY clause may appear in a SELECT statement that does not contain a WHERE clause - Correct or Incorrect of ORDER BY clause ?
Correct
Which of the following update statements will change the salary and job title of employee Scott to that of Adams?

Each correct answer represents a complete solution. Choose all that apply.

A: UPDATE EMP
SET SAL=(SELECT SAL FROM EMP WHERE ENAME='ADAMS'),
JOB=(SELECT JOB FROM EMP WHERE ENAME='ADAMS')
WHERE ENAME='SCOTT';

B: UPDATE EMP
SET JOB=(SELECT JOB FROM EMP WHERE ENAME='ADAMS'),
SAL=(SELECT SAL FROM EMP WHERE ENAME='ADAMS')
WHERE ENAME='SCOTT';

C: UPDATE EMP
SET (SAL,JOB)=(SELECT SAL,JOB FROM EMP WHERE ENAME='ADAMS')
WHERE ENAME='SCOTT';

D: UPDATE EMP
SET (SAL,JOB)=(SELECT SAL,JOB FROM EMP WHERE ENAME='SCOTT')
WHERE ENAME='ADAMS';
A: UPDATE EMP
SET SAL=(SELECT SAL FROM EMP WHERE ENAME='ADAMS'),
JOB=(SELECT JOB FROM EMP WHERE ENAME='ADAMS')
WHERE ENAME='SCOTT';

B: UPDATE EMP
SET JOB=(SELECT JOB FROM EMP WHERE ENAME='ADAMS'),
SAL=(SELECT SAL FROM EMP WHERE ENAME='ADAMS')
WHERE ENAME='SCOTT';

C: UPDATE EMP
SET (SAL,JOB)=(SELECT SAL,JOB FROM EMP WHERE ENAME='ADAMS')
WHERE ENAME='SCOTT';
You cannot perform a multitable insert into a remote table - Correct or Incorrect ?
Correct
Which pseudocolumn retrieves the next available sequence value?
NEXTVAL
Consider the following query for displaying the records of various species:

SET PAGESIZE 450
COLUMN species FORMAT A12
COLUMN species_tree FORMAT A25
SELECT species_id, LEVEL, LPAD (' ', 2*LEVEL-1,'_') || species_id AS
Species, SYS_CONNECT_BY_PATH (species_id, '>') AS SpeciesTree
FROM species_info
START WITH genus_id IS NULL
CONNECT BY PRIOR species_id=genus_id;

Which of the following statements are TRUE about the output of the given query? (Choose all that apply.)

The species column is not formatted.

The species_tree column is not formatted.

Individual species in the column whose column header is species are indented.

Individual species in the species_tree column are separated by '>'.
Individual species in the column whose column header is species are indented.

Individual species in the species_tree column are separated by '>'.
TIMESTAMP WITH LOCAL TIME ZONE - stores value of --
18-JAN-03 12.00.00.000000 AM'
Evaluate the following SQL statements in the given order:

DROP TABLE dept;

CREATE TABLE dept
(deptno NUMBER(3) PRIMARY KEY,
deptnameVARCHAR2(10));

DROP TABLE dept;

FLASHBACK TABLE dept TO BEFORE DROP;

Which statement is true regarding the above FLASHBACK operation?

A. It recovers only the first DEPT table.
B. It recovers only the second DEPT table.
C. It does not recover any of the tables because FLASHBACK is not possible in this case.
D. It recovers both the tables but the names would be changed to the ones assigned in the
RECYCLEBIN.
B
When performing a self join, what must be used to qualify table names?
table aliases
SQL subquery can be used to replace a self join or vice versa - True or False ?
1
What is the relationship between the number of groups created by the ROLLUP operation and the number of grouping columns specified in the SELECT clause?
The number of groups created by the ROLLUP operation is one more than the number of grouping columns specified
You can nest up to 255 levels of sub-queries in the WHERE clause - True or False ?
1
SELECT CONCAT(LOWER(SUBSTR(description, 1, 3)), subject_id) "Subject Description" FROM subject; In which order are the functions evaluated?
SUBSTR, LOWER, CONCAT
A simple view in which column aliases have been used cannot be updated - Correct or Incorrect about VIEWS ?
Incorrect
Single Row Functions cannot be used in the WHERE and ORDER BY clauses - True or False ?
1
A role can be granted to PUBLIC - Correct or Incorrect about ROLES ?
Correct
Which conditions should be satisfied so that a subquery may be called as a single-row subquery?
If the inner query returns a single value to the main query
It fetches data from two or more tables - Correct or Incorrect about Simple View ?
Incorrect
SOUNDEX()
SOUNDEX()

SOUNDEX returns a character string containing the phonetic representation of char.
This function lets you compare words that are spelled differently, but sound alike in English.

char can be of any of the data types CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The
return value is the same data type as char.

This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion.
The main query and subquery can get data from different tables - Correct or Incorrect ?
Correct
To remove a constraint from a table, which clause of the ALTER TABLE statement should you use?
The DROP clause. The syntax is ALTER TABLE tablename DROP PRIMARY KEY | UNIQUE (column) | CONSTRAINT constraintname [CASCADE];
Which SQL capability is demonstrated when two or more tables are linked with a WHERE clause?
joining
Which is specified to indicate that the table is temporary and that its definition is visible to all sessions with appropriate privileges?
GLOBAL TEMPORARY
When you create an External Table in your schema, can you specify the tablespace in which this table will be stored?
No, the actual rows of an External Table are stored as a file in the Operating System
A view or table can have only one primary key - Correct or Incorrect about Primary Key Constraint ?
Correct
If no column list is specified in an INSERT statement, your VALUES clause must list the values in what order?
the order in which the columns are specified in the table
Which of the following flashback features efficiently manage and query long-term historical data?
Total Recall
Which of the following queries would produce a similar result set?

Each correct answer represents a complete solution. Choose two.

A: SELECT COUNT (EMPID) FROM EMP;
B: SELECT AVG (SAL) FROM EMP;
C: SELECT SUM (SAL) FROM EMP;
D: SELECT SUM (SAL) / COUNT (EMPID) FROM EMP;
B: SELECT AVG (SAL) FROM EMP;
D: SELECT SUM (SAL) / COUNT (EMPID) FROM EMP;
You maintain the database for a corporate organization that has several employees on contract. The organization decides that contractual employees who have worked for a year should be made permanent. You need to reflect these changes by inserting records of those from the contract_employees table into the employees table and changing the date of hire to the current date.

Which of the following statements achieves the desired output?

INSERT INTO employees
SELECT emp_id, job_profile, LAST_DAY(hire_date) "Hire Date", salary
FROM contract_employees
WHERE MONTHS_BETWEEN (CURRENT_DATE(), hire_date) >=12;

INSERT INTO employees
SELECT emp_id, job_profile, ADD_MONTHS (hire_date, 12) "Hire Date", salary
FROM contract_employees;

INSERT INTO employees
SELECT emp_id, job_profile, CURRENT_DATE, salary FROM contract_employees
WHERE MONTHS_BETWEEN (CURRENT_DATE, hire_date) >=12;

INSERT INTO employees
SELECT emp_id, job_profile, CURRENT_DATE, salary FROM contract_employees
WHERE EXTRACT (MONTH FROM hire_date) =12;
INSERT INTO employees
SELECT emp_id, job_profile, CURRENT_DATE, salary
FROM contract_employees
WHERE MONTHS_BETWEEN (CURRENT_DATE, hire_date) >=12;
EXTRACT(datetime)
EXTRACT extracts and returns the value of a specified datetime field from a datetime or interval expression. The expr can be any expression that evaluates to a datetime or interval data type compatible with the requested field:

■ If YEAR or MONTH is requested, then expr must evaluate to an expression of data type DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE, or INTERVAL YEAR TO MONTH.

■ If DAY is requested, then expr must evaluate to an expression of data type DATE,TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE,or INTERVAL DAY TO SECOND.

■ If HOUR, MINUTE, or SECOND is requested, then expr must evaluate to an expression of data type TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE, or INTERVAL DAY TO SECOND. DATE is not valid here, because Oracle Database treats it as ANSI DATE data type, which has no time fields.

■ If TIMEZONE_HOUR, TIMEZONE_MINUTE, TIMEZONE_ABBR, TIMEZONE_REGION,
or TIMEZONE_OFFSET is requested, then expr must evaluate to an expression of data type TIMESTAMP WITH TIME ZONE or TIMESTAMP WITH LOCAL TIME ZONE.

EXTRACT interprets expr as an ANSI datetime data type. For example, EXTRACT treats DATE not as legacy Oracle DATE but as ANSI DATE, without time elements.Therefore, you can extract only YEAR, MONTH, and DAY from a DATE value. Likewise, you can extract TIMEZONE_HOUR and TIMEZONE_MINUTE only from the TIMESTAMP
WITH TIME ZONE data type.

The following example returns from the oe.orders table the number of orders placed in each month:

SELECT EXTRACT(month FROM order_date) "Month", COUNT(order_date) "No. of Orders" FROM orders GROUP BY EXTRACT(month FROM order_date) ORDER BY "No. of Orders" DESC, "Month";

Month No. of Orders
---------- -------------
11 15
6 14
7 14
3 11
5 10

The following example returns the year 1998.
SELECT EXTRACT(YEAR FROM DATE '1998-03-07') FROM DUAL;

EXTRACT(YEARFROMDATE'1998-03-07')
---------------------------------
1998

The following example selects from the sample table hr.employees all employees who were hired after 2007:

SELECT last_name, employee_id, hire_date
FROM employees WHERE EXTRACT(YEAR FROM TO_DATE(hire_date, 'DD-MON-RR')) > 2007 ORDER BY hire_date;

LAST_NAME EMPLOYEE_ID HIRE_DATE
------------------------- ----------- ---------
Johnson 179 04-JAN-08
Grant 199 13-JAN-08
Marvins 164 24-JAN-08
You work as a SQL technical consultant for Dolliver Inc. You want to convert the 20.345
string and add 64.187 numeric value to 20.345.

Which of the following SQL statements will you use to accomplish the task?

A: SELECT to_number("20.345") + 64.187 FROM DUAL;

B: SELECT to_number('20.345') + 64.187 FROM DUAL;

C: SELECT to_number(20.345) + 64.187 FROM DUAL;

D: SELECT to_number(20.345) + '64.187' FROM DUAL;
B: SELECT to_number('20.345') + 64.187 FROM DUAL;
The third parameter of the REGEXP_REPLACE function specifies the replacement for whatever matches the pattern, which is specified in the second parameter. What will the pattern if the third parameter is omitted?replace
NULL.
In which situations will Oracle database automatically perform sorting operations on row data?
When using the ORDER BY clause in SQL. / When using the GROUP BY clause in SQL. / When an index is created
You work as a Database Developer for Dolliver Inc. The company uses Oracle as its
database. The database contains a table named Employee. The table contains the following columns:

z emp_id
z emp_first_name
z emp_last_name
z department_id

The company has five departments. Now, you want to calculate the sum of the average
length of employees' last name per department.

Which of the following queries will you
use to accomplish the task?

A: SELECT SUM(AVG(LENGTH(LAST_NAME))) FROM Employee HAVING
DEPARTMENT_ID = NOT NULL

B: SELECT SUM(AVG(LENGTH(LAST_NAME))) FROM Employee GROUP BY
DEPARTMENT_ID

C: SELECT SUM(AVG(LENGTH(LAST_NAME))) FROM Employee GROUP BY
DEPARTMENT_ID;

D: SELECT SUM(AVG(LENGTH(LAST_NAME))) FROM Employee HAVING
DEPARTMENT_ID = NOT NULL;
C: SELECT SUM(AVG(LENGTH(LAST_NAME))) FROM Employee GROUP BY DEPARTMENT_ID;
Up to how many levels can a user nest subqueries in the WHERE clause?
255
Which of the following are the types of materialized views?

Each correct answer represents a complete solution. Choose all that apply.

A: Writeable materialized view
B: Updateable materialized view
C: Read only materialized view
D: Write only materialized view
A: Writeable materialized view
B: Updateable materialized view
C: Read only materialized view
According to operator precedence, are OR conditions evaluated before AND conditions?
No, AND conditions are evaluated before OR conditions.
Which clauses can a user use in a hierarchical query to filter out specific rows from the output?
WHERE
You maintain the database for a chain of multiplex. You need to display the revenue generated for all the movies screened at different locations of the multiplex on a monthly basis. You only need to display the monthly revenue not the grand total across all the months.

Which of the following query displays the desired output?

SELECT movie_id, location, month, (tickets_sold*ticket_cost) AS Revenue FROM
movie_sales GROUP BY ROLLUP (movie_id, location, month);

SELECT movie_id, location, month, (tickets_sold*ticket_cost) AS RevenueFROM
movie_sales GROUP BY movie_id, ROLLUP (location, month);

SELECT movie_id, location, month, (tickets_sold*ticket_cost) AS Revenue FROM
movie_sales GROUP BY movie_id, location, ROLLUP (month);

SELECT movie_id, location, month, (tickets_sold*ticket_cost) AS Revenue FROM
movie_sales GROUP BY movie_id, month, ROLLUP (location);
SELECT movie_id, location, month, (tickets_sold*ticket_cost) AS Revenue FROM
movie_sales GROUP BY movie_id, location, ROLLUP (month);
Which two sets of join keywords create a join that will include unmatched rows from the first table specified in the SELECT statement?
LEFT OUTER JOIN and FULL OUTER JOIN
It produces only the subtotals for the groups specified in the GROUP BY clause - Correct or Incorrect reharding ROLLUP operator ?
Incorrect
Which two operators can be used in an outer join condition using the outer join operator (+)?
(=) / AND
The ROUND number function returns a number rounded to the specified column value - True or False ?
1
Which function adds or subtracts months from a given date?
ADD_MONTHS. The syntax of the ADD_MONTHS function is ADD_MONTHS(date, n), where n is a positive or negative integer.
A role can contain both system and object privileges - Correct or Incorrect about ROLES ?
Correct
ERROR : ORA-01756: quoted string not properly terminated. What should you do to execute the query successfully?
Use Quotes (q) operator and delimiter to allow the use of the single quotation mark in the literal character string.
An index owner can be different than the table owner - Correct or Incorrect about Indexes ?
Correct
ROUND(date)
ROUND (date)

ROUND returns date rounded to the unit specified by the format model fmt. This function is not sensitive to the NLS_CALENDAR session parameter. It operates according to the rules of the Gregorian calendar. The value returned is always of data type DATE, even if you specify a different datetime data type for date. If you omit fmt, then date is rounded to the nearest day. The date expression must resolve to a DATE value.

The following example rounds a date to the first day of the following year:

SELECT ROUND (TO_DATE ('27-OCT-00'),'YEAR') "New Year" FROM DUAL;

New Year
---------
01-JAN-01
You have created a view MED_BENEFITS on a table BENEFITS. After you created the view, the BENEFITS table was altered. Which of the following SQL statements will ensure the view is still valid—or determine if the view requires more substantial modification ?
ALTER VIEW MED_BENEFITS COMPILE;
If you fail to name a constraint, what will Oracle name the constraint?
SYS_Cn, where n is an integer making the constraint name unique in that schema
Arithmetic expressions that include a NULL value always evaluate to what value?
NULL
Constraints can be created after a table is created - True or False ?
TRUE
SQL can insert, update, and delete records from a database - Correct or Incorrect about SQL ?
Correct
The EMP table has been updated recently by HR users and you discover some inconsistent data in the table for couple of employees. Which should you use to track changes made to table data over the past period of time?
FLASHBACK VERSION QUERY
You can update or delete rows in a table based on rows in another table by including what within your DML statements?
subqueries
Users can query the dictionary view DBA_UNUSED_COL_TABS to see a list of all tables that have unused columns - Correct or Incorrect about UNUSED column ?
Correct
It can be used to remove a row from a table by setting all of the row’s columns to a value of NULL - Correct or Incorrect about UPDATE statements ?
Incorrect
You maintain the records of the students of a university. You need to create a tabular report showing the following data:

z number of students in the same year
z number of students in the same branch
z number of students in the same branch as well as in the same year
z total number of students across all the branches and years

For those rows where the number of students in the same year is calculated, you need to display Same Year Batch in the Year column. Similarly, for those rows where the number of students in the same branch is calculated, you need to display Same Branch in the Branch column.

Which of the following query should you use to achieve the desired output?

SELECT GROUPING(branch) AS Student_Branch, GROUPING(year) AS Student_Batch,
COUNT(*) AS TotalStudents FROM students
GROUP BY CUBE(branch,year);

SELECT DECODE(GROUPING(branch), 1,"Same Branch",branch) AS Student_Branch,
DECODE(GROUPING(year), 1, "Same Year Batch", year) AS Student_Batch, COUNT(*) AS
TotalStudents FROM students GROUP BY CUBE(branch,year);

SELECT DECODE(GROUPING(branch), 0,"Same Branch",branch) AS Student_Branch,
DECODE(GROUPING(year), 1, "Same Year Batch", year) AS Student_Batch, COUNT(*) AS
TotalStudents FROM students GROUP BY CUBE(branch,year);

SELECT (GROUPING(branch), 1,"Same Branch",branch) AS Student_Branch,
DECODE(GROUPING(year), 0, "Same Year Batch", year) AS Student_Batch, COUNT(*) AS
TotalStudents FROM students GROUP BY CUBE(branch,year);
SELECT DECODE(GROUPING(branch), 1,"Same Branch",branch) AS Student_Branch,
DECODE(GROUPING(year), 1, "Same Year Batch", year) AS Student_Batch, COUNT
(*) AS TotalStudents FROM students GROUP BY CUBE(branch,year);
TO_CLOB()
TO_CLOB()

TO_CLOB converts NCLOB values in a LOB column or other character strings to CLOB
values. char can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. Oracle Database executes this function by converting the underlying LOB data from the national character set to the database character set.

From within a PL/SQL package, you can use the TO_CLOB function to convert RAW, CHAR, VARCHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB values to CLOB or NCLOB values.
View the Exhibit and examine the structure of the ORDERS table. Which task would require
subqueries?

A. displaying the total order value for sales representatives 161 and 163

B. displaying the order total for sales representative 161 in the year 1999

C. displaying the number of orders that have order mode online and order date in 1999

D. displaying the number of orders whose order total is more than the average order total for all
online orders
D
Evaluate the following SQL statement:

SELECT product_name || 'it's not available for order'
FROM product_information
WHERE product_status = 'obsolete';

You received the following error while executing the above query:

ERROR:
ORA-01756: quoted string not properly terminated

What would you do to execute the query successfully?

A. Enclose the character literal string in the SELECT clause within the double quotation marks.

B. Do not enclose the character literal string in the SELECT clause within the single quotation marks.

C. Use Quote (q) operator and delimiter to allow the use of single quotation mark in the literal character string.

D. Use escape character to negate the single quotation mark inside the literal character string in
the SELECT clause.
C
What will be the output of the following query? SELECT CEIL(268651.894, 2) FROM DUAL;
Oracle Error
You are the database administrator for a store that sells electronic equipment. To track information about customers who have bought products from your store, you create the customerdetails table by executing the
following statement:

CREATE TABLE customerdetails
(
customerid VARCHAR2(5) CONSTRAINT cus_pk PRIMARY KEY,
customername VARCHAR2(30) NOT NULL,
emi NUMBER(10) CONSTRAINT ins_check CHECK (emi BETWEEN 500 AND 3000),
Months NUMBER (3) CONSTRAINT mon_check (months BETWEEN 3 AND 24)
);

Due to interest rate changes, the EMI value for all new and existing customers needs to be a minimum of $1,000.

Which of the following statements ensures that the minimum EMI is $1,000? (Choose two. Each correct answer is a separate solution.)

ALTER TABLE customerdetails DISABLE CONSTRAINT ins_check;

ALTER TABLE customerdetails DROP CONSTRAINT ins_check;

ALTER TABLE customerdetails DISABLE CONSTRAINT ins_check;
ALTER TABLE customerdetails ADD CONSTRAINT emi_check (emi BETWEEN 1000 AND 3000);

ALTER TABLE CustomerDetails DROP CONSTRAINT Ins_Check;
ALTER TABLE CustomerDetails ADD CONSTRAINT EMI_Check (EMI BETWEEN 1000 AND 3000);
ALTER TABLE customerdetails DISABLE CONSTRAINT ins_check;
ALTER TABLE customerdetails ADD CONSTRAINT emi_check (emi BETWEEN 1000 AND 3000);

ALTER TABLE CustomerDetails DROP CONSTRAINT Ins_Check;
ALTER TABLE CustomerDetails ADD CONSTRAINT EMI_Check (EMI BETWEEN 1000 AND 3000);
You work as a Database Designer for Dolliver Inc. The company uses Oracle 11g as its
database. The database contains a table named Employee. The structure of the table is
given below :

Emp_id Emp_name Emp_address Emp_contact Emp_commission

You want to fetch the names of those employees who do not earn any commission.

Therefore, you issue the following query by using SQL Developer:

SELECT Emp_name FROM EMPLOYEE
WHERE Emp_commission = NULL;

What will be the result of executing the above SQL statement?

A: It will display an error message mentioning inappropriate use of operator.

B: It will return the rows that have non-null values in the Emp_commission column.

C: It will retrieve the names of those employees whose commission is NULL.

D: It will not return any rows and will also not display any error message.
D: It will not return any rows and will also not display any error message
Which can be included in the INSERT ALL / FIRST target list when none of the explicit conditions are satisfied?
ELSE
You want to update the city column of the EMPLOYEE table for all the rows with the
corresponding value in the city column of the ADDRESS table for each employee.

Which SQL statement would you execute to accomplish the task?

A: UPDATE EMPLOYEE e
SET city=(SELECT city FROM ADDRESS a)
WHERE e.Address_ID=a.Address_ID;

B: UPDATE EPLOYEE e
SET city=ALL (SELECT city FROM ADDRESS a
WHERE e.Address_ID=a.Address_ID);

C: UPDAE EMPLOYEE e
SET city=ANY (SELECT city FROM ADDRESS a);

D: UPDATE EMPLOYEE e
SET city=(SELECT city FROM ADDRESS a
WHERE e.Address _ID=a.Address_ID);
D: UPDATE EMPLOYEE e
SET city=(SELECT city FROM ADDRESS a
WHERE e.Address _ID=a.Address_ID);
It enables users to recover the data from the table if the query is being deleted - Correct or Incorrect regarding the benefits of using the WITH clause ?
Incorrect
The product table contains these columns:

product_id NUMBER NOT NULL
product_name VARCHAR2(25)
supplier_id NUMBER
list_price NUMBER(7,2)
cost NUMBER(7,2)

You need to increase the list price and cost of all products supplied by Global Imports by 5.5 percent. The SUPPLIER_ID for Global Imports is 105.

Which statement should you use?

UPDATE product
SET list_price = list_price * 1.055
SET cost = cost * 1.055 WHERE supplier_id = 105;

UPDATE product
SET list_price = list_price * .055 AND
cost = cost * .055 WHERE supplier_id = 105;

UPDATE product
SET list_price = list_price * 1.055, cost = cost * 1.055 WHERE supplier_id = 105;

UPDATE product
SET list_price = list_price + (list_price * .055), cost = cost + (cost * .055)
WHERE supplier_id LIKE 'Global Imports, Inc.';
UPDATE product
SET list_price = list_price * 1.055, cost = cost * 1.055
WHERE supplier_id = 105;
HAVING clause cannot reference an expression unless that expression is first referenced in the GROUP BY clause - Correct or Incorrect ?
Incorrect
Which type of outer join will include all rows from both tables being joined?
a full outer join
In clauses is the GROUPING SETS specified?
GROUP BY
View the Exhibit and examine the data in ORDERS_MASTER and MONTHLYjDRDERS tables.

Evaluate the following MERGE statement:

MERGE INTO orders_master o
USING monthly_orders m
ON (o.order_id = m.order_id)
WHEN MATCHED THEN
UPDATE SET o.order_total = m.order_total
DELETE WHERE (m.order_total IS NULL)
WHEN NOT MATCHED THEN
INSERT VALUES (m.order_id, m.order_total);

What would be the outcome of the above statement?

A. The ORDERS_MASTER table would contain the ORDERJDs 1 and 2.

B. The ORDERS_MASTER table would contain the ORDERJDs 1,2 and 3.

C. The ORDERS_MASTER table would contain the ORDERJDs 1,2 and 4.

D. The ORDERS MASTER table would contain the ORDER IDs 1,2,3 and 4.
C
The UNION operator is used to combine the result-sets - Correct or Incorrect about Using the UNION operator ?
Correct
It comprises of data dictionary views and dynamic performance views - Correct or Incorrect about Oracle Data Dictionary ?
Correct
It is possible to nest single-row functions - True or False ?
1
Which prevent DML operations, such as INSERT, UPDATE and DELETE on a view?
ROWNUM pseudo column / SQL GROUP functions / GROUP BY clause / DISTINCT keyword
What will be the result of executing the following SQL statement? SELECT NULLIF('01-Aug-2008','01-Aug-08') FROM DUAL;
08-01-08
TO_NUMBER()
TO_NUMBER()

TO_NUMBER converts expr to a value of NUMBER data type. The expr can be a
BINARY_DOUBLE value or a value of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data
type containing a number in the format specified by the optional format model fmt.

You can specify an expr of BINARY_FLOAT. However, it makes no sense to do so
because a float can be interpreted only by its internal presentation.

The 'nlsparam' argument in this function has the same purpose as it does in the TO_CHAR function for number conversions.

This function does not support CLOB data directly. However, CLOBs can be passed in
as arguments through implicit data conversion.
A UNIQUE constraint on a column requires an index - If a UNIQUE index already exists on the column, it will be used - Correct or Incorrect ?
Correct
GRANT ALTER TABLE TO PUBLIC - Correct or Incorrect ?
Incorrect
Which function replaces a NULL value with a specified value?
NVL
revoke privileges from user on object; - Correct or Incorrect for revoking privileges on a table?
Incorrect
If a table is created without specifying a schema, in which schema will it be?
It will be in the PUBLIC schema
You cannot add a NOT NULL constraint to an existing column using the ALTER TABLE statement - Correct or Incorrect about NOT NULL constraints ?
Incorrect
Which string operator is an alternative to the CONCAT function?
||
Which clause in an UPDATE statement specifies the rows that will be updated?
the WHERE clause
The condition of a check constraint can refer to any column in the table, but it cannot refer to columns of other tables - Correct or Incorrect about CHECK constraints ?
Correct
For existing rows in a table, UPDATE can add values to any column with a NULL value - Correct or Incorrect ?
Correct
Which data dictionary views contains the definition of a view?
USER_VIEWS
INITCAP()
INITCAP returns char, with the first letter of each word in uppercase, all other letters in lowercase. Words are delimited by white space or characters that are not alphanumeric.

char can be of any of the data types CHAR, VARCHAR2, NCHAR, or NVARCHAR2. The
return value is the same data type as char. The database sets the case of the initial characters based on the binary mapping defined for the underlying character set.

This function does not support CLOB data directly. However, CLOBs can be passed in as arguments through implicit data conversion.

The following example capitalizes each word in the string:

SELECT INITCAP('the soap') "Capitals"
FROM DUAL;

Capitals
---------
The Soap
View the Exhibit and examine the data in the LOCATIONS table.

Evaluate the following SOL statement:

SELECT street_address
FROM locations
WHERE
REGEXP_INSTR(street_address,'[^[: alpha:]]') = 1;

Which statement is true regarding the output of this SOL statement?

A. It would display all the street addresses that do not have a substring 'alpha'.

B. It would display all the street addresses where the first character is a special character

C. It would display all the street addresses where the first character is a letter of the alphabet.

D. It would display all the street addresses where the first character is not a letter of the alphabet.
D
If you as a database user want to grant a role (which has certain object level privileges) to a user
SCOTT and enable him to grant the role further on to other users, which option will you use in the
GRANT command?

A: WITH GRANT OPTION
B: WITH ADMIN OPTION
C: WITH ROLE OPTION
D: There is no such option available for roles.
B: WITH ADMIN OPTION
You need to load information about new customers from the NEW_CUST table into the tables CUST and CUST_SPECIAL If a new customer has a credit limit greater than 10,000, then the details have to be inserted into CUST_SPECIAL All new customer details have to be inserted into the CUST table. Which technique should be used to load the data most efficiently?

A. external table
B. the MERGE command
C. the multitable INSERT command
D. INSERT using WITH CHECK OPTION
C
What command will create a new table which has a similar structure to an existing table, and also include all or some of the rows from that original table?
Create Table As Select (CTAS)
You work as a Database Developer for Gadgets Inc. The company uses Oracle as its
database. The database contains a table named Employee. You issue the following query against the Employee table:

SELECT Department_id, COUNT(last_name)
FROM Employee;

Which of the following statements about the above mentioned query is true?

A: It will retrieve the department id's of those employees whose last name exists.
B: It will retrieve the department id's of all employees.
C: It will retrieve the department id's of those employees whose last name column has
a NULL value.
D: It will return an error message
D: It will return an error message
The query name in the WITH clause is visible to other query blocks in the WITH clause as well as to the main query block. - Correct or Incorrect regarding the WITH clause ?
Correct
You work as a Database Administrator for Bell Ceramics Inc. The company uses Oracle
as its database. It provides online consultancy 24X7 by using the database. The database contains a table named Transaction. The schema of the table is given below:

T_id T_cost T_info T_cat

Later on, you felt that the T_cat column is unnecessary. Therefore, you decided not to
include the column in the table. The table is being used at high load, which of the following actions will you perform to accomplish the task without affecting the normal business hours?

A: You will drop the entire table and recreate it.
B: You will perform a logical delete.
C: You will perform a physical delete.
D: You will drop all the columns of the table and recreate the columns.
B: You will perform a logical delete
HAVING clause must occur after the GROUP BY clause - Correct or Incorrect ?
Incorrect
Which grouping functions does NOT ignore null values?
COUNT(*)
It finds all the NULL values in the superaggregates for the groups specified in the GROUP BY clause - Correct or Incorrect regarding CUBE operator ?
Incorrect
Evaluate the following incomplete SQL statement:

SELECT Component_Name, Description
FROM COMPONENT

You want to display only the rows that Have 'harddisks' as part of the string in the
Description column of the COMPONENT table.

Which of the following WHERE clause Options can give you the desired result?

Each correct answer represents a complete solution. Choose all that apply.

A: WHERE REGEXP_LIKE (Description, '^H|hard+.s$');

B: WHERE REGEXP_LIKE (Description, '^H|hard*.s');

C: WHERE REGEXP_LIKE (Description, 'hard+.s');

D: WHERE REGEXP_LIKE (Description, '^H|hard+.s');
B: WHERE REGEXP_LIKE (Description, '^H|hard*.s');
C: WHERE REGEXP_LIKE (Description, 'hard+.s');
D: WHERE REGEXP_LIKE (Description, '^H|hard+.s');
What kind of join automatically joins two or more tables based on common column names?
Natural Join
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its
database. The database contains a table named Employee. You want to retrieve the record of those employees who have at least one person reporting to them.

Which of the following queries will you use to accomplish the task?

Each correct answer represents a complete solution. Choose two.

A: SELECT employee_id, last_name, job_id, department_id FROM Employees WHERE
employee_id IN (SELECT manager_id FROM Employees WHERE manager_id is NULL);

B: SELECT employee_id, last_name, job_id, department_id FROM Employees outer
WHERE EXISTS (SELECT 'x' FROM Employees WHERE manager_id = outer.employee_id);

C: SELECT employee_id, last_name, job_id, department_id FROM Employees WHERE
employee_id IN (SELECT manager_id WHERE manager_id is NOT NULL);

D: SELECT employee_id, last_name, job_id, department_id FROM Employees WHERE
employee_id IN (SELECT manager_id FROM Employees WHERE manager_id is NOT NULL);
B: SELECT employee_id, last_name, job_id, department_id FROM Employees outer
WHERE EXISTS (SELECT 'x' FROM Employees WHERE manager_id = outer.employee_id);

D: SELECT employee_id, last_name, job_id, department_id FROM Employees WHERE
employee_id IN (SELECT manager_id FROM Employees WHERE manager_id is NOT NULL);
The USER_CONS_COLUMNS view should be queried to find the names of the columns to which constraint applies - Correct or Incorrect about VIEWS ?
Correct
Which join types returns rows from the left side of the predicate for which there are no corresponding rows on the right side of the predicate?
Antijoin
To_CHAR converts a date expression to a character expression - True or False ?
1
Subqueries that return more than one column are referred to as what type of subqueries?
multiple-column subqueries
Which aggregate functions do not ignore null values?
GROUPING_ID, COUNT (*), GROUPING
LNNVL()
LNNVL provides a concise way to evaluate a condition when one or both operands of the condition may be null. The function can be used in the WHERE clause of a query, or as the WHEN condition in a searched CASE expression. It takes as an argument a condition and returns TRUE if the condition is FALSE or UNKNOWN and FALSE if the condition is TRUE. LNNVL can be used anywhere a scalar expression can appear, even
in contexts where the IS [NOT] NULL, AND, or OR conditions are not valid but would otherwise be required to account for potential nulls.

Oracle Database sometimes uses the LNNVL function internally in this way to rewrite NOT IN conditions as NOT EXISTS conditions. In such cases, output from EXPLAIN PLAN shows this operation in the plan table output. The condition can evaluate any scalar values but cannot be a compound condition containing AND, OR, or BETWEEN.
A UNIQUE constraint on a column requires an index - If any index exists on the column, there will be an error as Oracle attempts to create another index implicitly - Correct or Incorrect ?
Incorrect
revoke privileges; - Correct or Incorrect for revoking privileges on a table?
Incorrect
The CASCADE CONSTRAINTS option of the REVOKE statement removes any constraints made to the object using which privilege?
REFERENCES (foreign key constraints)
Which is a character large object containing Unicode characters?
NCLOB
NVL()
NVL()

NVL lets you replace null (returned as a blank) with a string in the results of a query. If expr1 is null, then NVL returns expr2. If expr1 is not null, then NVL returns expr1.

The arguments expr1 and expr2 can have any data type. If their data types are different, then Oracle Database implicitly converts one to the other. If they cannot be converted implicitly, then the database returns an error. The implicit conversion is implemented as follows:

■ If expr1 is character data, then Oracle Database converts expr2 to the data type of expr1 before comparing them and returns VARCHAR2 in the character set of expr1.
■ If expr1 is numeric, then Oracle Database determines which argument has the highest numeric precedence, implicitly converts the other argument to that data type, and returns that data type.
NOT NULL constraints can only be defined at the column level - Correct or Incorrect about NOT NULL constraints ?
Correct
Single Row Functions can accept a column name, expression, variable name, or a user-supplied constant as arguments. - True or False ?
1
The SQL statement is not case sensitive - Correct or Incorrect about SELECT statement ?
Correct
ALTER TABLE products DROP (discount, servicetax); - Correct or Incorrect ?
Correct
If you want to insert data in a table manually using the INSERT statement, what keyword will be followed by the input data in the INSERT statement?
VALUES
If an ALTER TABLE . . . DROP COLUMN statement is executed against an underlying table upon which a view is based, the status of that view in the data dictionary changes to
INVALID
Which set operators will not sort the rows?
UNION ALL
Which o clauses is used to retrieve rows affected by a DML statement?
returning_clause
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. You create an object table named Object_employee. The object table has
emp_id, emp_name, and emp_sal as its attributes. You insert five rows in the object
table. Now, you want to retrieve all rows of the object table.

Which of the following statements can you use to accomplish the task?

Each correct answer represents a complete solution. Choose all that apply.

A: SELECT * FROM oe;

B: SELECT * FROM object_employee;

C: SELECT VALUE(oe).emp_id, VALUE(oe).emp_name, VALUE(oe).emp_sal FROM
object_employee oe;

D: SELECT VALUE(oe) FROM object_employee oe;
B: SELECT * FROM object_employee;

C: SELECT VALUE(oe).emp_id, VALUE(oe).emp_name, VALUE(oe).emp_sal FROM object_employee oe;

D: SELECT VALUE(oe) FROM object_employee oe;
Consider the following UPDATE statement:

UPDATE books
SET price=price+100, royalty=royalty*1.25, (book_type, publication)=(SELECT
category, publication FROM authors WHERE author_rank=1)
WHERE author_id= (SELECT author_id FROM authors WHERE author_rank=1);

Which of the following statements are TRUE about the UPDATE statement? (Choose all that apply.)

price is increased by 100 for all the books.

royalty is increased by 25% for all the books by the top author.

book_type is updated for all the books.

publication is updated for books by the top author
royalty is increased by 25% for all the books by the top author.

publication is updated for books by the top author
View the Exhibit and examine the description of the EMPLOYEES table.

Your company decided to give a monthly bonus of $50 to all the employees who have completed
five years in the company. The following statement is written to display the LAST_NAME,
DEPARTMENT_ID, and the total annual salary:

SELECT last_name, departmentjd, salary450*12 "Annual Compensation" FROM employees WHERE MONTHS_BETWEEN(SYSDATE, hire_date)/12 >= 5;

When you execute the statement, the "Annual Compensation" is not computed correctly. What
changes would you make to the query to calculate the annual compensation correctly?

A. Change the SELECT clause to SELECT last_name, department_id, salary*12+50 "Annual
Compensation".

B. Change the SELECT clause to SELECT last_name, department_id, salary+(50*12) "Annual
Compensation".

C. Change the SELECT clause to SELECT last_name, department_id, (salary +50)*12 "Annual Compensation".

D. Change the SELECT clause to SELECT last_name, department_id, (salary*12)+50 "Annual
Compensation".
C
View the Exhibit and examine the data in the PRODUCTS table.

Which statement would add a column called PRICE, which cannot contain NULL?

A. ALTER TABLE products
ADD price NUMBER(8,2) NOT NULL;

B. ALTER TABLE products
ADD price NUMBER(8,2) DEFAULT NOT NULL;

C. ALTER TABLE products
ADD price NUMBER(8,2) DEFAULT 0 NOT NULL;

D. ALTER TABLE products
ADD price NUMBER(8,2) DEFAULT CONSTRAINT p_nn NOT NULL;
C
It can improve the performance of a large query by storing the result of a query block having the WITH clause in the user's temporary tablespace - Correct or Incorrect refarding the benefits of using the WITH clause ?
Correct
Which two WHERE clause conditions demonstrate the correct usage of conversion functions?


A. WHERE order_date > TO_DATE('JUL 10 2006','MON DD YYYY)

B. WHERE TO_CHAR(order_date,'MON DD YYYY) = 'JAN 20 2003'

C. WHERE order_date > TO_CHAR(ADD_MONTHS(SYSDATE,6),'MON DD YYYY")

D. WHERE order_date IN (TO_DATE('Oct 21 2003','Mon DD YYYY"), TO_CHAR('NOV 21 2003','Mon DD YYYY"))
A. WHERE order_date > TO_DATE('JUL 10 2006','MON DD YYYY)

B. WHERE TO_CHAR(order_date,'MON DD YYYY) = 'JAN 20 2003'
Group functions can execute multiple times within a single group - Correct or Incorrect ?
Incorrect
Which SELECT statement clause restricts included rows prior to grouping?
a WHERE clause
View the Exhibit and examine the data in the cust_data table:

cust_ID credit_Limit grade gender
1 17000 A F

INSERT
WHEN credit_limit >=10000 THEN
INTO cust_1 VALUES (cust_id, credit_limit, grade, gender)
WHEN grade= 'B' THEN
INTO cust_2 VALUES (cust_id, credit_limit, grade, gender)
WHEN gender= 'M' THEN
INTO cust_3 VALUES (cust_id, credit_limit, grade, gender)
INTO cust_4 VALUES (cust_id, credit_limit, grade, gender)
ELSE
INTO cust_5 VALUES (cust_id, credit_limit, grade, gender)
SELECT * FROM cust_data;

In which of the following tables will the rows be inserted?

A: CUST_1, CUST_2 and CUST_5 tables, because credit_limit and grade conditions are
satisfied but gender condition is not satisfied.

B: CUST_1 and CUST_2 tables, because credit_limit and grade conditions are satisfied.

C: CUST_1 table only, because credit_limit condition is satisfied.

D: CUST_1, CUST_2 and CUST_4 tables, because credit_limit and grade conditions are
satisfied for CUST_1 and CUST_2, and CUST_4 has no condition on it.
C: CUST_1 table only, because credit_limit condition is satisfied
You are tasked to create a CHECK constraint on a column to ensure that any incoming data for phone numbers is entered in a format like this: (101)202-3330 Which regular expression patterns will work in the CHECK constraint?
'([[:digit:]]{3})[[:digit:]]{3}-[[:digit:]]{4}'
Which is another name of an inner join?
Equality Join
Consider the following query executed for an employees table:

SELECT * FROM employees WHERE (dept_id, salary) IN (SELECT dept_id, MAX(Salary) FROM
employees
WHERE jobprofile != 'Manager' GROUP BY deptid);

What is the output of the given query?

Details of all the employees are displayed.

Details of all the employees are displayed department-wise

Details of the employee having the highest salary across all departments are displayed.

Details of the employees having the highest salary in each department are displayed.
Details of the employees having the highest salary in each department are displayed
Which views would you use to display the column names and DEFAULT values for a table?
USER TAB COLUMNS
You issue this statement:

CREATE PUBLIC SYNONYM part
FOR linda.product;

Which task was accomplished by this statement?

A new segment object was created.

A new object privilege was assigned.

A new system privilege was assigned.

The need to qualify an object name with its schema was eliminated
The need to qualify an object name with its schema was eliminated
Which type of join joins all rows in one table to all rows of another table?
a Cartesian product or cross join
Which clauses can be used to identify hierarchical queries?
CONNECT BY / START WITH
Which aggregate functions ignore null values?
AVG
A UNIQUE constraint on a column requires an index - If a NONUNIQUE index already exists it will be used - Correct or Incorrect ?
Correct
Which two functions can be used to pad a character string to the right or left with a specified character?
the RPAD and LPAD functions
revoke privileges from user; - Correct or Incorrect for revoking privileges on a table?
Incorrect
Which statements is used to change the default roles for a user?
ALTER USER
COALESCE()
COALESCE returns the first non-null expr in the expression list. You must specify at
least two expressions. If all occurrences of expr evaluate to null, then the function returns null.

Oracle Database uses short-circuit evaluation. The database evaluates each expr value and determines whether it is NULL, rather than evaluating all of the expr values before determining whether any of them is NULL.

If all occurrences of expr are numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type, then Oracle Database determines the argument with the highest numeric precedence, implicitly converts the remaining arguments to that data type, and returns that data type.

This function is a generalization of the NVL function.
You can also use COALESCE as a variety of the CASE expression. For example,

COALESCE(expr1, expr2)
is equivalent to:
CASE WHEN expr1 IS NOT NULL THEN expr1 ELSE expr2 END

Similarly,
COALESCE(expr1, expr2, ..., exprn)
where n >= 3, is equivalent to:
CASE WHEN expr1 IS NOT NULL THEN expr1
ELSE COALESCE (expr2, ..., exprn) END
You need to add a FOREIGN KEY constraint to the LINE_ITEM_ID column in the CURR_ORDER table to refer to the ID column in the LINE_ITEM table. Which statement should you use to achieve this result?
ALTER TABLE curr_order ADD CONSTRAINT line_itemid_fk FOREIGN KEY (line_item_id) REFERENCES line_item (id);
A view may have column names that are different than the actual base table(s) column names by using column aliases - Correct or Incorrect concerning the creation of a view ?
Correct
SELECT ROUND (to_date ('10-AUG-04'), 'YEAR') FROM DUAL; What will be the result of the SQL statement?
1-Jan-05
When testing each row in the emp table to determine whether any employee doesn't have an email, how should the WHERE clause be written if you want the information displayed?about those employees who don't have an email to be
WHERE email is NULL
Which clauses is used to identify a table, view, materialized view, or partition or to specify a subquery that identifies the objects?
query_table_expression
How can you delete the values from one column of every row in a table?
Use the UPDATE command
The data dictionary is owned by:
SYS
Which of the following set operations takes the result set of one SELECT statement, and removes those rows that are also returned by the second SELECT statement?
MINUS
Which statements are considered DML?
SELECT / INSERT
All the constraints can be defined at the column level as well as the table level - Correct or Incorrect regarding Constraints ?
Incorrect
You are the database administrator for a multinational organization that specializes in diverse products. You maintain information of different departments within the organization in an Oracle database.

Your task is to display data about the number of employees that work in each division of the company.

Which of the following queries would work for this?

SELECT d.divnum, d.divname, (SELECT count(*) FROM employee e WHERE e.divnum = d.divnum) AS "Num Emp" FROM division d;

SELECT * FROM employee e WHERE e.divnum = d.divnum FROM division d;

SELECT d.divnum, d.divname (SELECT * FROM division d) AS "Emp Num" FROM division d;

SELECT d.divnum, d.divname, (SELECT count(*) FROM employee e) AS "Emp Num" FROM
division d;
SELECT d.divnum, d.divname, (SELECT count(*) FROM employee e WHERE e.divnum = d.divnum) AS "Num Emp" FROM division d;
OE and SCOTT are the users in the database.

The ORDERS table is owned by OE.

Evaluate the statements issued by the DBA in the following sequence:

CREATE ROLE r1;

GRANT SELECT, INSERT ON oe. orders TO r1;

GRANT r1 TO scott;

GRANT SELECT ON oe. orders TO scott;

REVOKE SELECT ON oe.orders FROM scott;

What would be the outcome after executing the statements?

A. SCOTT would be able to query the OE.ORDERS table.

B. SCOTT would not be able to query the OE.ORDERS table.

C. The REVOKE statement would remove the SELECT privilege from SCOTT as well as from the role R1.

D. The REVOKE statement would give an error because the SELECT privilege has been granted
to the role R1
A
Which of the following options will produce the same result set as the given SQL query?

SQL> SELECT * FROM DEPT A
2 WHERE A.DEPTNO NOT IN (SELECT A.DEPTNO FROM EMP A);

A: SELECT * FROM DEPT A
WHERE NOT EXISTS (SELECT 'X' FROM EMP B);

B: SELECT * FROM DEPT A
WHERE NOT EXISTS (SELECT 'X' FROM EMP B
WHERE A.DEPTNO = B.DEPTNO);

C: SELECT * FROM DEPT A
WHERE EXISTS (SELECT 'X' FROM EMP B
WHERE A.DEPTNO=B.DEPTNO);

D: SELECT * FROM DEPT A
WHERE EXISTS (SELECT 'X' FROM EMP B
WHERE A.DEPTNO != B.DEPTNO);
B: SELECT * FROM DEPT A
WHERE NOT EXISTS (SELECT 'X' FROM EMP B
WHERE A.DEPTNO = B.DEPTNO);
Evaluate the following SQL statement:

CREATE INDEX upper_name_idx
ON product_information(UPPER(product_name));

Which query would use the UPPER_NAME_IDX index?

A. SELECT UPPER(product_name)
FROM product_information
WHERE product_jd = 2254;

B. SELECT UPPER(product_name)
FROM product_jnformation;

C. SELECT product_id
FROM product_jnformation
WHERE UPPER(product_name) IN ('LASERPRO', 'Cable);

D. SELECT product_jd, UPPER(product_name)
FROM product_information
WHERE UPPER(product_name)='LASERPRO' OR list_price > 1000;
C
Which qualifiers is the DEFAULT when no qualifier is specified with any of the group functions?
ALL
Evaluate the following command:

CREATE TABLE EMPLOYEES
(employee_id NUMBER (2) PRIMARY KEY,
last_name VARCHAR2(25) NOT NULL,
age NUMBER(2)
department_id NUMBER(2),
job_id VARCHAR2(8),
salary NUMBER(10, 2));

You issue the following command to create a view that displays the IDs and last names of the sales staff in the organization:

CREATE OR REPLACE VIEW sales_staff_view AS
SELECT employee_id, last_name, job_id
FROM EMPLOYEES
WHERE job_id LIKE 'DA_%' WITH CHECK OPTION;

Which of the following statements is true regarding the above view?

A: It allows you to insert details of all new staff into the EMPLOYEES table
.
B: It allows you to delete the details of the existing sales staff from the EMPLOYEES table.

C: It allows you to drop the parent table EMPLOYEES.

D: It allows you to insert the IDs, last names, and job_ids of the sales staff from the view if it is used in multi-table INSERT statements.
B: It allows you to delete the details of the existing sales staff from the EMPLOYEES table.
The HAVING clause conditions can use aliases for the columns - Correct or Incorrect ?
Incorrect
View the Exhibit and examine the description of the EMPLOYEES table.

Your company decided to give a monthly bonus of $50 to all the employees who have completed
five years in the company. The following statement is written to display the LAST_NAME,
DEPARTMENT_ID, and the total annual salary:

SELECT last_name, department_id, salary+50*12 "Annual Compensation" FROM employees WHERE MONTHS_BETWEEN(SYSDATE, hire_date)/12 >= 5;

When you execute the statement, the "Annual Compensation" is not computed correctly.

What changes would you make to the query to calculate the annual compensation correctly?

A. Change the SELECT clause to SELECT last_name, department_id, salary*12+50 "Annual
Compensation".

B. Change the SELECT clause to SELECT last_name, department_id, salary+(50*12) "Annual
Compensation".

C. Change the SELECT clause to SELECT last_name, department_id, (salary +50)*12 "Annual
Compensation".

D. Change the SELECT clause to SELECT last_name, department_id, (salary*12)+50 "Annual
Compensation".
C
The CHECK constraint cannot include a subquery - Correct or Incorrect ?
Correct
Review the structure of the EMP table:

SQL> DESC EMP

Name Null? Type
----------- ----------- -----------
COMM NUMBER

SQL> SELECT COMM FROM EMP;

COMM
-----------------
800
1000
1200
400

6 rows selected

You have been asked to display the values in the COMM column. You should display NA
for NULL values.

Which of the following functions will you use to achieve the required result?

Each correct answer represents a part of the solution. Choose all that apply.

A: TO_CHAR
B: NULLIF
C: TO_NUMBER
D: NVL
A: TO_CHAR
D: NVL
The subquery is executed for each row returned by the parent query - Correct or Incorrect about Correlated subqueries ?
Correct
Which views describes all columns in the database that are specified in constraints?
DBA_CONS_COLUMNS
Which of the following queries will provide information about the number of employees
working under each manager and classify them based on their designation for each manager?

A: SELECT JOB, MGR, COUNT (*) AS TOTAL
FROM EMP GROUP BY ROLLUP (JOB, MGR);

B: SELECT MGR, JOB, COUNT (*) AS TOTAL
FROM EMP GROUP BY ROLLUP (MGR, JOB, TOTAL);

C: SELECT MGR, JOB, COUNT (*) AS TOTAL
FROM EMP GROUP BY ROLLUP (MGR, JOB);

D: SELECT MGR, JOB, COUNT (*) AS TOTAL
FROM EMP GROUP BY ROLLUP (JOB, MGR);
C: SELECT MGR, JOB, COUNT (*) AS TOTAL
FROM EMP GROUP BY ROLLUP (MGR, JOB);
Which symbols correctly represents the outer join operator?
+
Consider that a hierarchical query has the START WITH clause and a CONNECT BY PRIOR clause specified to generate a tree-structured output. What will happen if the START WITH clause returns multiple rows?
Oracle will process multiple hierarchies under each root row
An index created on multiple columns in a table is called what?
a composite or concatenated index
Which conversion functions is used to convert a ROWID value to VARCHAR2 datatype?
ROWIDTOCHAR
Which date function returns a DATE datatype representing the current database server date and time?
SYSDATE
GRANT CREATE VIEW ON table1 TO user1 - Correct or Incorrect ?
Incorrect
Views with the same name but different prefixes, such as DBA, ALL and USER, use the same base tables from the data dictionary - True or False regarding Data Dictionary Views ?
1
Which system privilege allows a user to connect to the database?
the CREATE SESSION system privilege
MAX()
MAX returns maximum value of expr. You can use it as an aggregate or analytic function.

The following example determines the highest salary in the hr.employees table:

SELECT MAX(salary) "Maximum"
FROM employees;

Maximum
----------
24000
You created the CUST_ACCOUNT_V view. Before you begin creating reports, you want to review the column derivations for accuracy. Which statement should you use?
SELECT text FROM user_views WHERE view_name = 'CUST_ACCOUNT_V';
Which conversion functions is used to convert a value to the BINARY_DOUBLE Data Type?
TO_BINARY_DOUBLE
Which prevent DML operations like INSERT, UPDATE and DELETE on a view?
The use of the SQL Group Functions / The use of the DISTINCT keyword / The use of the ROWNUM pseudo column / The use of the GROUP BY clause
Which will be valid to use the DISTINCT clause?
SELECT
Which integrities is enforced by a primary key?
Row integrity
If you have two WHEN conditions in an INSERT statement, what keyword will ensure the insertion is completed after evaluating only one WHEN condition?
FIRST
Which class of data dictionary views displays names of objects on which the user has been granted access rights?
ALL_
Which of the following statements can you use to look at the chained and migrated rows of a table?
ANALYZE statement
Which statements implicitly ends a database transaction?
CREATE TABLE
For how many days will the information for a flashback query be available if the UNDO_RETENTION initialization parameter is set to 172800 seconds?
Two
DELETE statements require a COMMIT to confirm the DELETE - Correct or Incorrect ?
Correct
Considering the exhibit given below:

SQL> INSERT INTO T1 VALUES (10,'JOHN');
1 row created

SQL> INSERT INTO T1 VALUES (12,'SAM');
1 row created

SQL> INSERT INTO T1 VALUES (15,'ADAM');
1 row created

SQL> SAVEPOINT A;
Savepoint created

SQL> UPDATE T1
2 SET NAME='SCOTT'
3 WHERE CUST_NBR=12;
1 row updated

SQL> SAVEPOINT B;
Savepoint created

SQL> DELETE FROM T1 WHERE NAME LIKE '%A%';
1 row deleted

SQL> GRANT SELECT ON T1 TO BLAKE;
Grant succeeded

SQL> ROLLBACK;
Rollback complete

What will be the output of SELECT * FROM T1;?

A: CUST_NBR NAME
---------------- ---------
10 JOHN
12 SCOTT

B: CUST_NBR NAME
---------------- ---------
10 JOHN

C: CUST_NBR NAME
---------------- ---------
10 JOHN
15 ADAM

D: CUST_NBR NAME
---------------- ---------
10 JOHN
12 SCOTT
15 ADAM
A: CUST_NBR NAME
---------------- ---------
10 JOHN
12 SCOTT
View the Exhibit and examine the structure of the ORDERS and ORDERJTEMS tables.

Evaluate the following SQL statement:

SELECT oi.order_id, product_jd, order_date
FROM order_items oi JOIN orders o
USING(order_id);

Which statement is true regarding the execution of this SQL statement?

A. The statement would not execute because table aliases are not allowed in the JOIN clause.

B. The statement would not execute because the table alias prefix is not used in the USING
clause.

C. The statement would not execute because all the columns in the SELECT clause are not
prefixed with table aliases.

D. The statement would not execute because the column part of the USING clause cannot have a
qualifier in the SELECT list.
D
You are the DBA for an international airline. You execute the following query:

SELECT flight_no, TO_CHAR(flight_date, 'DL'), TO_CHAR(return_flight_date, 'DL'),
TO_CHAR(booking_date, 'DS')
FROM flight_bookings
WHERE EXTRACT(YEAR FROM booking_date)=EXTRACT (YEAR FROM CURRENT_DATE())
AND
EXTRACT (MONTH FROM booking_date) BETWEEN 4 AND 9;

Which of the following statements are TRUE about the given query? (Choose all that apply.)

The flight_date, return_flight_date, and booking_date columns are displayed in the Long Date format.

THe flight_date and return_flight_date columns are displayed in the Long Date format, and the
booking_date column is displayed in the Short Date format.

Records of the flights booked between May and October of the current year are displayed.

Records of the flights booked between April and September of the current year are displayed.
The flight_date and return_flight_date columns are displayed in the Long Date format, and the booking_date column is displayed in the Short Date format.

Records of the flights booked between April and September of the current year are displayed.
Which grouping functions does ignore null values?
AVG, NVL, SUM
The EMP table has been updated recently by HR users and you discover some inconsistent
data in the table for couple of employees.

Which of the following should you use to track changes made to table data over the past
period of time?

A: FLASHBACK DATABASE
B: FLASHBACK VERSION QUERY
C: FLASHBACK TABLE
D: FLASHBACK DROP
B: FLASHBACK VERSION QUERY
You want to retrieve rows of those students whose enrollment number does not include a digit. For this purpose, you used the caret (^) metacharacter. Which of the following is the correct usage of a metacharacter?
[^[:digit:]]
Which of the following views list tables that have partially completed DROP COLUMN
operations?

Each correct answer represents a complete solution. Choose all that apply.
A: ALL_PARTIAL_DROP_TABS

B: DBA_PARTIAL_DROP_TABS

C: USER_PARTIAL_DROP_TABS

D: ADMIN_PARTIAL_DROP_TABS
Another name for an EXISTS query is:
Semijoin
Which of the following function-based indexes will help in the execution of caseinsensitive SQL queries against that table?

Each correct answer represents a part of the solution. Choose all that apply.

A: CREATE INDEX IDX3
ON CUSTOMER (LOWER(CNAME));

B: CREATE INDEX IDX4
ON CUSTOMER (UPPER(CNAME));

C: CREATE INDEX IDX1
ON CUSTOMER (CNAME);

D: CREATE INDEX IDX2
ON CUSTOMER (INITCAP(CNAME));
A: CREATE INDEX IDX3
ON CUSTOMER (LOWER(CNAME));

B: CREATE INDEX IDX4
ON CUSTOMER (UPPER(CNAME));
In which clauses can an aggregate functions appear in a SQL statement?
HAVING / SELECT / ORDER BY
Which types of join contains a join condition that uses an equality operator to process the join condition?
Equi join
Evaluate the following DELETE statement:

DELETE FROM employee;

There are no other uncommitted transactions on the employee table. Which statement is true about the DELETE statement?

A: It removes all the rows as well as the structure of the table.
B: It would not remove the rows if the table has a primary key.
C: It removes only the rows that have a NULL value in them.
D: It removes all the rows in the table and allows ROLLBACK.
D: It removes all the rows in the table and allows ROLLBACK
They help in creating reports using tree branching methods - Correct or Incorrect about Hierarchial Queries ?
Correct
Which statement would you use to delete a synonym?
DROP SYNONYM synonym_name;
SELECT MONTHS_BETWEEN('15-JAN-2008', '25-MAY-2008') FROM DUAL; What will be the result of the above SQL query?
-4.3225806
It is not possible for a subquery to contain ORDER-BY clause - True or False ?
1
If the subquery returns NULL, the main query may still return result rows - True or False regarding Subqueries ?
1
Built-In SQL Functions Are written by SQL developers and also known as “user-defined” functions - True or False ?
1
TRIM()
TRIM()

TRIM enables you to trim leading or trailing characters (or both) from a character string. If trim_character or trim_source is a character literal, then you must enclose it in single quotation marks.

■ If you specify LEADING, then Oracle Database removes any leading characters equal to trim_character.

■ If you specify TRAILING, then Oracle removes any trailing characters equal to trim_character.

■ If you specify BOTH or none of the three, then Oracle removes leading and trailing characters equal to trim_character.

■ If you do not specify trim_character, then the default value is a blank space.

■ If you specify only trim_source, then Oracle removes leading and trailing blank spaces.

■ The function returns a value with data type VARCHAR2. The maximum length of the value is the length of trim_source.

■ If either trim_source or trim_character is null, then the TRIM function returns null.

Both trim_character and trim_source can be VARCHAR2 or any data type that can be implicitly converted to VARCHAR2. The string returned is a VARCHAR2 (NVARCHAR2) data type if trim_source is a CHAR or VARCHAR2 (NCHAR or
NVARCHAR2) data type, and a CLOB if trim_source is a CLOB data type. The return
string is in the same character set as trim_source.
A sequence slows down the efficiency of accessing sequence values cached in memory - Correct or Incorrect about a Sequence ?
Incorrect
A role can be granted to itself - Correct or Incorrect about ROLES ?
Incorrect
Which statement reports on unique JOB_ID values from the EMPLOYEES table?
SELECT DISTINCT JOB_ID FROM EMPLOYEES;
Which constraints will cause an automatic creation of an index by Oracle to enforce the constraint?
Primary Key constraint
Which statement permanently removes all the rows in a table, the structure of the table, all constraints, all triggers on the table, and any associated indexes?
the DROP TABLE statement
Which objects is not categorized as schema objects and not stored in a schema?
Roles
How many ORDER BY clauses are allowed in a compound query?
only one
Like the Char data type, the VARCHAR data type also stores alphanumeric data values - True or False about Oracle Data Types ?
1
LOCK TABLE is a Type of which statement ---
DML statement
Which constraints requires values in one table to match values in another table?
Foreign key constraint
ROLLBACK can be used to get back the sales_date column in the Sales table - Correct or Incorrect about ALTER TABLE … SET UNUSED ?
Incorrect
Indexes cannot be created on external tables - Correct or Incorrect about EXTERNAL tables ?
Correct
You executed the following command to add a primary key to the EMP table:

ALTER TABLE emp
ADD CONSTRAINT emp_id_pk PRIMARY KEY (emp_id) USING INDEX emp_id_idx;

Which statement is true regarding the effect of the command?

A. The PRIMARY KEY is created along with a new index.

B. The PRIMARY KEY is created and it would use an existing unique index.

C. The PRIMARY KEY would be created in a disabled state because it is using an existing index.

D. The statement produces an error because the USING clause is permitted only in the CREATE
TABLE command.
B
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. The database contains a table named Employee. The table contains 10 records.

The rows in the table are arranged sequentially according to emp_id.

You issue the following query against the table:

SELECT * FROM Employee
WHERE emp_id > ALL (3,4);

Which of the following statements is true about the SQL query?

Note: The total number of employees in the company are 10.

A: The output will be 1 record.
B: The output will be 2 records.
C: It will return an error message.
D: The output will be 6 records
D: The output will be 6 records.
The first DROP operation is performed on PRODUCTS table using the following command:

DROP TABLE products PURGE;

Then you performed the FLASHBACK operation by using the following command:

FLASHBACK TABLE products TO BEFORE DROP;

Which statement describes the outcome of the FLASHBACK command?

A. It recovers only the table structure.

B. It recovers the table structure, data, and the indexes.

C. It recovers the table structure and data but not the related indexes.

D. It is not possible to recover the table structure, data, or the related indexes
D
You want to retrieve the total number of employees whose last_name ends with a letter s. Which queries will you use to accomplish the task?
SELECT COUNT(*) FROM employee WHERE SUBSTR (last_name, -1) = 's'; / SELECT COUNT(*) FROM employee WHERE last_name LIKE '%s';
GROUPING_ID()
GROUPING_ID returns a number corresponding to the GROUPING bit vector associated with a row. GROUPING_ID is applicable only in a SELECT statement that contains a GROUP BY extension, such as ROLLUP or CUBE, and a GROUPING function. In queries with many GROUP BY expressions, determining the GROUP BY level of a particular row requires many GROUPING functions, which leads to cumbersome SQL. GROUPING_ID is useful in these cases.

GROUPING_ID is functionally equivalent to taking the results of multiple GROUPING functions and concatenating them into a bit vector (a string of ones and zeros). By using GROUPING_ID you can avoid the need for multiple GROUPING functions and make row filtering conditions easier to express. Row filtering is easier with
GROUPING_ID because the desired rows can be identified with a single condition of GROUPING_ID = n. The function is especially useful when storing multiple levels of aggregation in a single table.
The result set of the queries in a WITH clause is stored in the user's temporary tablespace - Correct or Incorrect about the WITH clause ?
Correct
Evaluate this SQL statement:

SELECT p.po_num, s.supplier_name, p.po_date, p.po_total FROM po_header p, supplier s
WHERE p.supplier_id = s.supplier_id;

Which two SQL statements will produce identical results? (Choose two.)

SELECT p.po_num, s.supplier_name, p.po_date, p.po_total FROM po_header p JOIN supplier s
USING (p.supplier_id);

SELECT po_num, supplier_name, po_date, po_total FROM po_header NATURAL JOIN supplier;

SELECT p.po_num, s.supplier_name, p.po_date, p.po_total FROM po_header p JOIN supplier s
USING (p.supplier_id = s.supplier_id);

SELECT p.po_num, s.supplier_name, p.po_date, p.po_total FROM po_header p JOIN supplier s
USING (supplier_id);

SELECT p.po_num, s.supplier_name, p.po_date, p.po_total FROM po_header p NATURAL JOIN supplier s USING (supplier_id);
SELECT po_num, supplier_name, po_date, po_total
FROM po_header NATURAL JOIN supplier;

SELECT p.po_num, s.supplier_name, p.po_date, p.po_total
FROM po_header p JOIN supplier s USING (supplier_id);
What value will be returned by this regular expression? REGEXP_COUNT('AEioUIOUAEiOU','Ei',2,i)
2
Which is a way to sequence Oracle output rows?
Retrieve the rows in pre-sorted order / Oracle internal sort / Using a third-party sort product
According to the principle of least privilege, which of the following roles should be
granted to only the accounts that need the privilege?

Each correct answer represents a complete solution. Choose all that apply

A: ORACLE
B: SYSDBA
C: PUBLIC
D: SYSOPER
E: SYSASM
B: SYSDBA
D: SYSOPER
E: SYSASM
According to Oracle’s documentation, how many occurrences of the keyword PRIOR must exist in a CONNECT BY clause?
1
It can be used to specify a subquery -- Correct or Incorrect about the USING clause of MERGE statement ?
Correct
A sequence is created in the database using the following code:

SQL> CREATE SEQUENCE S1
2 INCREMENT BY -1
3 MAXVALUE -1
4 NOCYCLE;

Sequence created.

What will be the result of the following SQL statement when executed immediately after the sequence is created?

SELECT S1.NEXTVAL FROM DUAL;

A: -1
B: Oracle Error
C: 0
D: -2
A: -1
Which pseudocolumns is used to access the current value of the sequence?
CURRVAL
Which SQL functions is used to display the current session date and time?
SYSDATE
It produces higher-level subtotals, moving from right to left through the list of grouping columns specified in the GROUP BY clause - Correct or Incorrect about ROLLUP operator ?
Correct
Which function removes leading and/or trailing characters from a character string?
TRIM. The syntax of the TRIM function is TRIM(leading|trailing|both, trim_character, FROM column|expression)
Which clauses used in the SELECT statement is NOT supported in a view definition subquery?
FOR UPDATE OF
Which is true of character functions?
They are generally used to process text data
Which following keywords cannot be used with the CREATE SEQUENCE statement?
JOIN
A role can be granted to itself - Correct or Incorrect about ROLES ?
Incorrect
Which if present in a view definition ensures that rows cannot be deleted through a view?
DISTINCT
Which datatype is a hexadecimal string representing the unique address of a row in its table?
ROWID
FROM_TZ
FROM_TZ converts a timestamp value and a time zone to a TIMESTAMP WITH TIME ZONE value. time_zone_value is a character string in the format 'TZH:TZM' or a character expression that returns a string in TZR with optional TZD format.

The following example returns a timestamp value to TIMESTAMP WITH TIME ZONE:

SELECT FROM_TZ(TIMESTAMP '2000-03-28 08:00:00', '3:00') FROM DUAL;

FROM_TZ(TIMESTAMP'2000-03-2808:00:00','3:00')
---------------------------------------------------------------
28-MAR-00 08.00.000000000 AM +03:00
What form of the INSERT statement will insert all rows from a table into two or more other tables?
INSERT ALL
At which two levels can constraints be defined?
at the column or table level
Which of the following schema objects is a basic unit of storage in the Oracle Database?
Table
Which statements is used to drop a column from a table?
ALTER TABLE statement
Oracle recommends that when you add a constraint to a column, you must assign a meaningful name to it. What will Oracle do, if you fail to do so?
Assign a system generated name (SYS_Cn) to the constraint
The WHERE clause can be used to have your update affects a specific set of rows - Correct or Incorrect about UPDATE statement ?
Correct
They prevent deletion from/dropping of tables with dependant data/tables - Correct or Incorrect about CONSTRAINTS ?
Correct
Is there any table change as the result of the execution of a valid flashback operation using the AS OF clause?
No
Evaluate the following CREATE SEQUENCE statement:

CREATE SEQUENCE seql
START WITH 100
INCREMENT BY 10
MAXVALUE 200
CYCLE
NOCACHE;

The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue the
following SQL statement:

SELECT seql.nextval FROM dual;

What is displayed by the SELECT statement?

A. 1
B. 10
C. 100
D. an error
A
You want to create a report of all employees, including employee name and project name, who are assigned to project tasks. You want to include all projects even if they currently have no tasks defined, and you want to include all tasks, even those not assigned to an employee.

Which joins should you use?

a self join on the employee table and a left outer join between the task and project tables

a natural join between the task and employee tables and a natural join between the task and project tables

a full outer join between the task and employee tables and a natural join between the task and project tables

a natural join between the task and employee tables and a left outer join between the task and project tables

a full outer join between the task and employee tables and a full outer join between the task and
project tables

a left outer join between the task and employee tables and a right outer join between the task and
project tables
a left outer join between the task and employee tables and a right outer join between the task and project tables
FLOOR()
FLOOR returns the largest integer equal to or less than n. The number n can always be written as the sum of an integer k and a positive fraction f such that 0 <= f < 1 and n = k + f. The value of FLOOR is the integer k. Thus, the value of FLOOR is n itself if and only if n is precisely an integer.

This function takes as an argument any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. The function returns the same data type as the numeric data type of the argument.

The following example returns the largest integer equal to or less than 15.7:
SELECT FLOOR(15.7) "Floor" FROM DUAL;

Floor
----------
15
The names of the columns being compared must match - Correct or Incorrect about the Multiple Column Subquery ?
Incorrect
Evaluate the following SQL statement:

SELECT 2 col1,ycol2
FROM dual
UNION
SELECT 1 ,'x'
FROM dual
UNION
SELECT 3 .NULL
FROM dual
ORDER BY 2;

Which statement is true regarding the output of the SQL statement?

A. It would execute and the order of the values in the first column would be 3,2,1.

B. It would execute and the order of the values in the first column would be 1,2,3.

C. It would not execute because the column alias name has not been used in the ORDER BY
clause.

D. It would not execute because the number 2 in the ORDER BY clause would conflict with the
value 2 in the first SELECT statement.
B
Group Function can be used on columns or expressions - Correct or Incorrect ?
Correct
SELECT PORT_ID FROM PORTS WHERE 1=2; Which of the following is true of the SELECT statement?
It will execute and return none of the rows in the table.
Evaluate this CREATE TABLE statement:

CREATE TABLE customer (
customer_id NUMBER,
company_id VARCHAR2(30),
contact_name VARCHAR2(30),
contact_title VARCHAR2(20),
address VARCHAR2(30),
city VARCHAR2(25),
region VARCHAR2(10),
postal_code VARCHAR2(20),
country_id NUMBER DEFAULT 25,
phone VARCHAR2(20),
fax VARCHAR2(20),
credit_limit NUMBER (7,2));

Which three business requirements will this statement accomplish? (Choose three.)

Credit limit values can be up to $1,000,000.

Company identification values could be either numbers or characters, or a combination of both.

All company identification values are only 6 digits, so the column should be fixed in length.

Phone number values can range from 0 to 20 characters, so the column should be variable in length.

The value 25 should be used if no value is provided for the country identification when a record is inserted.
Company identification values could be either numbers or characters, or a combination of both.

Phone number values can range from 0 to 20 characters, so the column should be variable in length.

The value 25 should be used if no value is provided for the country identification when a record is inserted.
Which pseudocolumns in the metadata of the rows indicate the kind of operation performed on the rows?
VERSIONS_OPERATION
If user SCOTT wants to grant UPDATE rights on the EMP table to user BLAKE and also enable him to grant this privilege to other users, which option should SCOTT use in the grant statement to accomplish this?

A: WITH GRANT OPTION;
B: WITH FULL OPTION;
C: WITH ADMIN OPTION;
D: WITH PUBLIC OPTION;
A: WITH GRANT OPTION;
For most small tables, ______ are faster than index searches
full table scans
According to operator precedence, which of the three logical operators is evaluated first?
NOT is evaluated first. The order of precedence for logical operators is NOT, AND, and OR.
View the Exhibit and examine the structure of the EMPLOYEES table.

You want to retrieve hierarchical data of the employees using the top-down hierarchy.

Which SQL clause would let you choose the direction to walk through the hierarchy tree?

A. WHERE
B. HAVING
C. GROUP BY
D. START WITH
E. CONNECT BY PRIOR
E
What command could a user issue such that the default format of dates, when displayed as output, are not in the typical dd-Mon-yy format?
ALTER SESSION
It displays the grand total first - Correct or Incorrect about CUBE operator ?
Correct
It cannot be used with aggregate functions - Correct or Incorrect about ROLLUP operation ?
Incorrect
A subquery can be used in the FROM clause of a SELECT statement - True or False regarding Subqueries ?
1
Character functions can return character or number values - True or False ?
1
What are two possible literal names that, if assigned to the variable my_name in the following expression, would return a Boolean TRUE? SELECT * FROM dual WHERE REGEXP_LIKE(my_name, '^(R|B)ob(ert)?');
Robert, Bob
Which of the following is the default format to represent a date in an Oracle database?
DD-MON-YY
It contains the current object privileges available in the user session - Correct or Incorrect about the SESSION_PRIVS dictionary view ?
Incorrect
Indexes can be created on object columns and REF columns by using methods defined for the object - Correct or Incorrect about Indexes ?
Correct
TRUNC (date)
TRUNC (date)

The TRUNC (date) function returns date with the time portion of the day truncated to the unit specified by the format model fmt. This function is not sensitive to the NLS_CALENDAR session parameter. It operates according to the rules of the Gregorian calendar. The value returned is always of data type DATE, even if you specify a
different datetime data type for date. If you omit fmt, then the default format model 'DD' is used and the value returned is date truncated to the day with a time of midnight.

The following example truncates a date:

SELECT TRUNC(TO_DATE('27-OCT-92','DD-MON-YY'), 'YEAR') "New Year" FROM DUAL;
New Year
---------
01-JAN-92
The WITH clause can hold more than one query - Correct or Incorrect regarding the usage of WITH clause in complex correlated queries ?
Correct
Which view would you use to display the column names and DEFAULT values for a table?
USER_TAB_COLUMNS
Single Row Functions can return multiple values of more than one data type - True or False ?
1
Which of the following types of tables, used by oracle, allows data to be broken down into small pieces?
Partitioned table
A table cannot be created while users are using the database - True or False ?
1
Which clauses allows a user to set column values?
update_set_clause
What type of sort should be done in order to list the 10 highest paid employees in the table, starting with the highest paid person?
Descending
When a table is dropped, the corresponding indexes are automatically dropped - Correct or Incorrect about INDEXES ?
Correct
Multitable insert can be used on tables and views - Correct or Incorrect ?
Incorrect
The data in an external table is not backed up - Correct or Incorrect ?
Correct
The following query when executed gives an error, what is the cause of the error?

SELECT CUSTOMER, TO_CHAR(ORDERDATE,'YYYY') AS "YEAR", COUNT
(ORDERID) AS "ORDERS",
SUM(UNITPRICE*QUANTITY) AS "SALES"
FROM ORDERS
GROUP BY CUSTOMER, YEAR
ORDER BY YEAR
/

A: Column aliases are not allowed in the ORDER BY clause.

B: The HAVING clause is missing.

C: TO_CHAR function is not a group function, so it cannot be used with a GROUP BY clause.

D: Column aliases are not allowed in the GROUP BY clause
D: Column aliases are not allowed in the GROUP BY clause.
AVG()
AVG returns average value of expr.
This function takes as an argument any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type.
The function returns the same data type as the numeric data type of the argument.
You want to generate a hierarchical report for all the employees who report to the employee whose EMPLOYEE_ID is 100.

Which SQL clauses would you require to accomplish the task? (Choose all that apply.)

A. WHERE
B. HAVING
C. GROUP BY
D. START WITH
E. CONNECT BY
A,D,E
Which one of the regular expression functions returns a Boolean value?
REGEXP_LIKE
Which statement would you use to create an index for the emp_lname column?

CREATE INDEX employee(emp_lname);

CREATE INDEX employee(emp_lname) employee_emp_lname_idx;

CREATE INDEX employee_emp_lname_idx
ON employee;

CREATE INDEX employee_emp_lname_idx
ON employee(emp_lname);
CREATE INDEX employee_emp_lname_idx
Which logical condition returns TRUE when both of the conditions are met and returns FALSE if either condition is FALSE?
AND
You maintain the data about all the students registered for a particular certification exam through the Internet. Some of the students have entered the exam code incorrectly. It should appear as a series of alphas, followed by
a slash, followed by another series of alphas. Instead of putting the single / that separates the two groups of alphas characters, some students entered spaces, hyphens, or both. You need to format all the exam codes correctly by removing all the extra spaces and hyphens and replacing them with a single '/'.

Which of the following functions should you use to achieve the desired results (Choose all that apply)?

REGEXP_REPLACE(ExamCode, '(( ){1, }|(-){1, }', '/ ')

REGEXP_REPLACE(ExamCode, '(( )|(-)', ' /')

REGEXP_REPLACE(ExamCode, '(( )|(-)){1, }', '/')

REGEXP_REPLACE(ExamCode, '(( )(-)', ' /')
REGEXP_REPLACE(ExamCode, '(( ){1, }|(-){1, }', '/ ')

REGEXP_REPLACE(ExamCode, '(( )|(-)){1, }', '/')
Multitable inserts cannot be performed into nested tables - Correct or Incorrect ?
Correct
View the Exhibit and examine the structure of the
PRODUCT INFORMATION table.

Which two queries would work? (Choose two.)

A. SELECT product_name
FROM product_information
WHERE list_price = (SELECT AVG(list_price)
FROM product_information);

B. SELECT product_status
FROM product_information
GROUP BY product_status
WHERE list_price < (SELECT AVG(list_price)
FROM product_information);

C. SELECT product_status
FROM product_information
GROUP BY product_status
HAVING list_price > (SELECT AVG(list_price)
FROM product_information);

D. SELECT product_name
FROM product_jnformation
WHERE list_price < ANY(SELECT AVG(list_price)
FROM product_jnformation
GROUP BY product_status);
A,D
Using compound OR conditions is functionally equivalent to using which operator?
the IN operator (assuming the subject of each of the OR clauses is the same)
Evaluate the following statement:

INSERT ALL
WHEN order_total < 10000 THEN
INTO small_orders
WHEN order_total > 10000 AND order_total < 20000 THEN
INTO medium_orders
WHEN order_total > 2000000 THEN
INTO large_orders
SELECT order_id, order_total, customer_id
FROM orders;

Which statement is true regarding the evaluation of rows returned by the subquery in the INSERT
statement?

A. They are evaluated by all the three WHEN clauses regardless of the results of the evaluation of any other WHEN clause.

B. They are evaluated by the first WHEN clause. If the condition is true, then the row would be
evaluated by the subsequent WHEN clauses.

C. They are evaluated by the first WHEN clause. If the condition is false, then the row would be
evaluated by the subsequent WHEN clauses.

D. The INSERT statement would give an error because the ELSE clause is not present for support in case none of the WHEN clauses are true.
A
What is the syntax to return just the month portion of the values stored in column hire_date?
EXTRACT (MONTH FROM hire_date)
Group Functions can be passed as an argument to another group function - Correct or Incorrect ?
Correct
It is helpful in creating cross-tabular reports - Correct or Incorrect about CUBE operator ?
Correct
It produces only the grand totals for the groups specified in the GROUP BY clause - Correct or Incorrect reharding ROLLUP operator ?
Incorrect
Which type of join contains a join condition that uses an equality operator to process the join condition?
Equi-join
Built-In SQL Functions Can be invoked from a DELETE statement’s WHERE clause - True or False ?
TRUE
Which of the following is NOT a GROUP function? LENGTH() / COUNT() / AVG() / MAX()
LENGTH()
Which of the following conversion functions is used to convert a string value from one character set to another?
CONVERT
Which of the following denotes a subquery that is present in the FROM clause?
Inline view
DML operations on the table are relatively slower when indexes are created on columns.- Correct or Incorrect about Indexes ?
Correct
TRANSLATE ... USING()
TRANSLATE ... USING()

TRANSLATE ... USING converts char into the character set specified for conversions
between the database character set and the national character set.
A view can be based on another view - Correct or Incorrect about VIEWS ?
Correct
Which conversion functions is used to convert raw to a character value containing its hexadecimal equivalent?
RAWTOHEX
Which of the following data dictionary views contains information about grants on tables that have been made by other users to your user account, as well as grants on tables that have been made by your user account to other user accounts?
USER_TAB_PRIVS
The structure of a table cannot be modified while the table is online - True or False ?
1
A transaction consists of two statements. The first succeeds, but the second (which updates several rows) fails partway through because of a constraint violation. What will happen?
The second statement will be rolled back completely, and the first will remain uncommitted
How do you recognize a correlated subquery?
The outer query makes reference to the table name in the inner query.
They come into action when any database event occurs - Correct or Incorrect about CONSTRAINTS ?
Incorrect
SELECT TRUNC(15.79,1) "Truncate" FROM DUAL; What will be the output of the above SQL statement?
15.7
The inserted rows cannot be returned by the INSERT statement - Correct or Incorrect about Multi table Insert ?
Correct
It is possible to define a view by using the WITH CHECK OPTION clause - Correct or Incorrect about CHECK constraints ?
Correct
If you issue this statement: insert into t1 (c1,c2) values(select c1,c2 from t1); why will it fail?
Because the VALUES keyword is not used with a subquery
LEAST()
LEAST returns the least of the list of exprs. All exprs after the first are implicitly converted to the data type of the first expr before the comparison. Oracle Database compares the exprs using nonpadded comparison semantics. If the value returned by this function is character data, then its data type is always VARCHAR2.

The following statement selects the string with the least value:

SELECT LEAST 'HARRY','HARRIOT','HAROLD') "Least"
FROM DUAL;

Least
------
HAROLD
Which of the following correctly describes the ability of Oracle to "cache" the results of
a scalar subquery and reuse the value, even though the query "should" be called more
than once?

A: Buffering
B: Caching
C: Storing
D: Screening
B: Caching
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database.

You issue the following SQL statement to check the functionality of the TRUNC function:

SELECT TRUNC(15.79,1) "Truncate" FROM DUAL;

What will be the output of the above SQL statement?

A: 15.8
B: 1.579
C: 0
D: 15.7
D: 15.7
Which clauses forces Oracle to carry out sort operations in order to deduplicate the result set of a query?
DISTINCT
Which of the following SQL functions may use the GROUP BY clause in a SELECT statement?

Each correct answer represents a complete solution. Choose all that apply.

A: AVG
B: TO_NUMBER
C: SUM
D: TO_CHAR
A: AVG

C: SUM
Rows in the target table are updated if the join condition is not met - Correct or Incorrect about MERGE statement ?
Incorrect
Evaluate the following
incomplete SQL statement:

SELECT category_name ,category_description FROM categories_tab

You want to display only the rows that have 'harddisks' as part of the string in the
CATEGORY_DESCRIPTION column.

Which two WHERE clause options can give you the desired result? (Choose two.)

A. WHERE REGEXP_LIKE (category_description, 'hard+.s');

B. WHERE REGEXP_LIKE (category_description, '^H|hard+.s');

C. WHERE REGEXP_LIKE (category_description, '^H|hard+.s$');

D. WHERE REGEXP_LIKE (category_description, '[^Hlhard+.s]');
A,B
Which operator compares a value to a specific list of values?
the IN operator
Evaluate this SQL statement:

SELECT manufacturer_id, COUNT(*), order_date
FROM inventory
WHERE price > 5.00
GROUP BY order_date, manufacturer_id
HAVING COUNT(*) > 10
ORDER BY order_date DESC;

Which clause specifies which rows will be returned from the inventory table?

SELECT manufacturer_id, COUNT(*), order_date

WHERE price > 5.00

GROUP BY order_date, manufacturer_id

ORDER BY order_date DESC

HAVING COUNT(*) > 10
WHERE price > 5.00
Group Function can be used on only one column in the SELECT clause of a SQL statement - Correct or Incorrect ?
Incorrect
The CUBE operator:
Displays regular rows and superaggregate rows.
Which group functions returns the number of rows returned by a query?
COUNT
You work as a Database Administrator for MusicDhun Inc. The company uses Oracle as
its database. The database contains a table named Customer. While preparing the final
sales report for the month of January, you came across some ambiguities. Your assistant suggests you to verify the records of those customers whose name contains a text 'tin'.

Which of the following queries will you use to retrieve the rows of all those customers whose name contains the text 'tin'?

A: SELECT * FROM customer
WHERE cust_name LIKE'%tin%';

B: SELECT * FROM customer
WHERE cust_name LIKE'\'%tin%;

C: SELECT * FROM customer
WHERE cust_name LIKE'%tin';

D: SELECT * FROM customer
WHERE cust_name LIKE'\'%tin%'\';
A: SELECT * FROM customer
WHERE cust_name LIKE'%tin%';
Which is a function that provides an alternate and more compact way to identify subtotal rows?
GROUPING_ID
Which type of join contains a join condition that uses an equality operator to process the join condition?
Equijoin
Group functions may only be used when a GROUP BY clause is present - Correct or Incorrect ?
Incorrect
The USER_SYNONYM can provide information about private synonym - Correct or Incorrect about VIEWS ?
Correct
Single-Row Functions includes the SUM, AVERAGE and MAX functions - True or False ?
1
Aggregate function, such as SUM, COUNT, MIN, or MAX is commonly used in subqueries - True or False in regard to subquery ?
TRUE
A date value may be converted to a number value using the TO_NUMBER function - True or False ?
1
SUBSTR()
SUBSTR()

The SUBSTR functions return a portion of char, beginning at character position,
substring_length characters long. SUBSTR calculates lengths using characters as
defined by the input character set. SUBSTRB uses bytes instead of characters. SUBSTRC
uses Unicode complete characters. SUBSTR2 uses UCS2 code points. SUBSTR4 uses
UCS4 code points.

■ If position is 0, then it is treated as 1.
■ If position is positive, then Oracle Database counts from the beginning of char to find the first character.
■ If position is negative, then Oracle counts backward from the end of char.
■ If substring_length is omitted, then Oracle returns all characters to the end of char. If substring_length is less than 1, then Oracle returns null.

char can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or
NCLOB. The exceptions are SUBSTRC, SUBSTR2, and SUBSTR4, which do not allow
char to be a CLOB or NCLOB. Both position and substring_length must be of data type NUMBER, or any data type that can be implicitly converted to NUMBER, and must resolve to an integer. The return value is the same data type as char.
Floating-point numbers passed as arguments to SUBSTR are automatically converted to integers.

The following example returns several specified substrings of "ABCDEFG":

SELECT SUBSTR('ABCDEFG',3,4) "Substring"
FROM DUAL;

Substring
---------
CDEF

SELECT SUBSTR('ABCDEFG',-5,4) "Substring"
FROM DUAL;

Substring
---------
CDEF
If a column is used frequently in the search criteria of a WHERE clause, what additional attribute would that column need to have in order to consider building an index on it?
a column containing a wide range of values
A role:
Can be created by a user only if that user has the CREATE ROLE system privilege
Which data type is a hexadecimal string representing the unique address of a row in its table?
ROWID
Which attributes of the CREATE SEQUENCE statement is used to specify the interval between sequence numbers?
INCREMENT BY
Which of the following may follow the reserved word CREATE to form a complete SQL statement?
TABLE, VIEW, SEQUENCE
Which characters will you use to terminate and execute the SQL statement?
A semicolon (;), A forward slash (/)
Which SQL statement will you use to display a message in the following format? Outer1 Inner1 Inner2
SELECT CONCAT('Outer1', CONCAT(' Inner1', 'Inner2')) FROM DUAL;
Multitable inserts can only be performed on tables, not on views or materialized views - Correct or Incorrect ?
Correct
All database data is stored in:
TABLES
ALTER TABLE products DROP COLUMN discount DROP COLUMN servicetax; - Correct or Incorrect ?
Incorrect
Which statements indicate the end of a transaction?
After a COMMIT is issued / After a ROLLBACK is issued / After a CREATE statement is issued
A composite primary key can have more than 32 columns - Correct or Incorrect about Primary Key Constraint ?
Incorrect
The teacher table in your schema contains these columns:

id NUMBER(9) PRIMARY KEY
last_name VARCHAR2(25)
first_name VARCHAR2(25)
subject_id NUMBER(9)

You execute this statement:

SQL> CREATE INDEX teacher_name_idx
ON teacher(first_name, last_name);

Which of the following statements is true?

The statement creates a composite unique index

The statement creates a composite non-unique index.

You must have the CREATE ANY INDEX privilege for the statement to succeed.

The statement will fail because it contains a syntax error.
The statement creates a composite non-unique index.
Consider the following statements:

CREATE TABLE login_details
(
userid VARCHAR(20),
password VARCHAR (20),
CONSTRAINT pk_id PRIMARY KEY (userid) USING INDEX (CREATE INDEX uid_index ON
login_details (userid))
);

CREATE UNIQUE INDEX login_index ON login_details (userid, password);

ALTER TABLE login_details MODIFY PRIMARY KEY USING INDEX login_index;

ALTER TABLE login_details DROP PRIMARY KEY;

Which of the following is TRUE regarding the login_details table?

Only the uid_index index is dropped.

Only the login_index index is dropped.

The uid_index and the login_index indexes are dropped.

The uid_index and the login_index indexes are not dropped.
The uid_index and the login_index indexes are not dropped
The user SCOTT who is the owner of ORDERS and ORDERJTEMS tables issues the following
GRANT command:

GRANT ALL
ON orders, order_items
TO PUBLIC;

What correction needs to be done to the above statement?

A. PUBLIC should be replaced with specific usernames.

B. ALL should be replaced with a list of specific privileges.

C. WITH GRANT OPTION should be added to the statement.

D. Separate GRANT statements are required for ORDERS and ORDERJTEMS tables
D
RPAD()
RPAD()

RPAD returns expr1, right-padded to length n characters with expr2, replicated as many times as necessary. This function is useful for formatting the output of a query.

Both expr1 and expr2 can be any of the data types CHAR, VARCHAR2, NCHAR,NVARCHAR2, CLOB, or NCLOB. The string returned is of VARCHAR2 data type if expr1 is a character data type, NVARCHAR2 if expr1 is a national character data type, and a LOB if expr1 is a LOB data type. The string returned is in the same character set as
expr1. The argument n must be a NUMBER integer or a value that can be implicitly
converted to a NUMBER integer.

expr1 cannot be null. If you do not specify expr2, then it defaults to a single blank. If expr1 is longer than n, then this function returns the portion of expr1 that fits in n.

The argument n is the total length of the return value as it is displayed on your terminal screen. In most character sets, this is also the number of characters in the return value. However, in some multibyte character sets, the display length of a
character string can differ from the number of characters in the string.

The following example creates a simple chart of salary amounts by padding a single space with asterisks:

SELECT last_name, RPAD(' ', Salary/1000/1, '*') "Salary"
FROM employees
WHERE department_id = 80
ORDER BY last_name, "Salary";

LAST_NAME Salary
------------------------- ---------------
Abel **********
Ande *****
Banda *****
Bates ******
Bernstein ********
Bloom *********
Cambrault **********
Which keyword overrides the default sort order in an ORDER BY clause?
DESC
Which of the following values is returned after the following SQL statement is executed?

SELECT ADD_MONTHS(SYSDATE,-1) FROM DUAL:

Assume the value of SYSDATE to be 31-JUL-2008 12:05pm.

A: 30-JUN-2008 12:05pm
B: 01-AUG-2008 12:05pm
C: 31-JUL-2008 12:05pm
D: 30-JUL-2008 12:05pm
A: 30-JUN-2008 12:05pm
If you use GROUP BY, then you have to use at least one group function - Correct or Incorrect ?
Incorrect
When a GROUP BY clause contains multiple columns, which grouping is the most major grouping?
the first column listed in the GROUP BY clause
You work as a Database Administrator for Bell Inc. The company uses Oracle as its
database. You write a PL/SQL block to retrieve data from a table named Employee and
place the data in another table named Salary.
You also write comments in the PL/SQL
block as and when required.

Which of the following are the correct and valid ways of putting a comment in an Oracle program?

Each correct answer represents a complete solution. Choose two.

A: --- (three dashes)
B: -- (two dashes)
C: ---- (four dashes)
D: /*...*/
B: -- (two dashes)

D: /*...*/
Which operators is used to produce cumulative aggregates such as subtotals?
ROLLUP
What element of the SELECT * FROM emp WHERE salary > ( SELECT 2 * MAX(bonus_amt) FROM bonus); query assures that the subquery will return exactly one value?
The group function MAX in the subquery.
The table name appears twice in the FROM clause - Correct or Incorrect about Self-Joins ?
Correct
Evaluate the following SQL statements that are issued in the given order:

CREATE TABLE dept
(dept_no NUMBER (2) CONSTRAINT dept_no_pk PRIMARY KEY,
dname VARCHAR2(15),
dlocation VARCHAR2(20),
mgr_no NUMBER(2) CONSTRAINT dept_mgr_fk REFERENCES dept);

ALTER TABLE dept
DISABLE CONSTRIANT dept_no_pk CASCADE;

ALTER TABLE dept
ENABLE CONSTRIANT dept_no_pk;

What would be the status of the foreign key dept_mgr_fk?

A: It would be automatically dropped.

B: It would remain disabled and can be enabled only by dropping the foreign key constraint and re-creating it.

C: It would remain disabled and has to be enabled manually using the ALTER TABLE command.

D: It would be automatically enabled and deferred.
C: It would remain disabled and has to be enabled manually using the ALTER TABLE command.
A multiple-column subquery if failed caused the table to get deleted - Correct or Incorrect about Multiple column Subquery ?
Incorrect
The usernames of all the users including the database administrators are stored in the data dictionary - Correct or Incorrect about VIEWS ?
Correct
Which SELECT statement clause would you use with the JOIN keyword to specify a traditional join predicate?
the ON clause
Which is true of functions?
They always return a value.
What type of subquery returns more than one row of data?
a multiple-row subquery
The current date is January 1, 2009. You need to store this date value: 19/10/1999 Which statement about the date format for this value is true?
The RR date format will interpret the year as 1999, and the YY date format will interpret the year as 2099
To create a sequence in your own schema, you must have the CREATE SEQUENCE system privilege - Correct or Incorrect about Sequences created in a single instance database ?
Correct
Which is the system privilege that is required as a minimum to allow a user account to log in to the database?
CREATE SESSION
Which privilege must a user be granted to be able to change another user's password?
the ALTER USER privilege
If you as a database user want to grant a role (which has certain object level privileges) to a user SCOTT and enable him to grant the role further on to other users, which option will you use in the GRANT command?
WITH ADMIN OPTION
What's the advantage of using IN rather than = in the following query? SELECT title, author, pub_date FROM books WHERE author IN (SELECT name FROM classics WHERE genre = 'ROMANCE');
Multiple values could be returned by the subquery without causing the statement to fail.
SELECT NVL(INSTR('1#2#3#4#5#','#',11), 'The # symbol not found') FROM DUAL; - Correct or Incorrect ?
Correct
Which of the following schema objects is stored in the database and can be created and manipulated with SQL but is not contained in a schema?
Role
The appropriate background process that fits as the main component of the Flashback Database Architecture --
RVWR
When a character column contains data, can you decrease the width of the column?
Yes, but only if the existing data does not violate the new size
Which reserved words is required in a complete DELETE statement?
DELETE
On which of the following levels can constraint be created?
Column / Table
Which statement removes rows in a table but can be rolled back?
DELETE
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. The database contains a table named Employee. The table stores employee's id, name (first + last), address, dependents, contact number, and department. You want to retrieve the employee's name including their first_name and the last_name
separated by a space character. The name should be stored in a third column.

Which of the following queries will you use to accomplish the task?

A: SELECT first_name ||" "|| last_name AS "Name" FROM Employee;

B: SELECT first_name ||' '|| last_name AS "Name"
FROM Employee;

C: SELECT first_name ||' '|| last_name AS 'Name'
FROM Employee;

D: SELECT first_name ||" " || last_name AS 'Name'
B: SELECT first_name ||' '|| last_name AS "Name"
FROM Employee;
Which of the following options will produce the same output as produced by the query
given below?

SELECT E.ENAME, D.DEPTNO, D.DNAME
FROM EMP E
RIGHT OUTER JOIN DEPT D
ON E.DEPTNO=D.DEPTNO;

A: SELECT E.ENAME, D.DEPTNO, D.DNAME
FROM EMP E, DEPT D
WHERE E.DEPTNO(+)=D.DEPTNO;

B: SELECT E.ENAME, D.DEPTNO, D.DNAME
FROM EMP E, DEPT D
WHERE E.DEPTNO=D.DEPTNO;

C: SELECT E.ENAME, D.DEPTNO, D.DNAME
FROM EMP E, DEPT D
WHERE E.DEPTNO=D.DEPTNO(+);

D: SELECT E.ENAME, D.DEPTNO, D.DNAME
FROM EMP E, DEPT D
WHERE E.DEPTNO!=D.DEPTNO;
A: SELECT E.ENAME, D.DEPTNO, D.DNAME
FROM EMP E, DEPT D
WHERE E.DEPTNO(+)=D.DEPTNO;
DENSE_RANK()
DENSE_RANK computes the rank of a row in an ordered group of rows and returns the rank as a NUMBER. The ranks are consecutive integers beginning with 1. The largest rank value is the number of unique values returned by the query. Rank values are not skipped in the event of ties. Rows with equal values for the ranking criteria receive the same rank. This function is useful for top-N and bottom-N reporting.

This function accepts as arguments any numeric data type and returns NUMBER.

■ As an aggregate function, DENSE_RANK calculates the dense rank of a hypothetical
row identified by the arguments of the function with respect to a given sort specification. The arguments of the function must all evaluate to constant expressions within each aggregate group, because they identify a single row
within each group. The constant argument expressions and the expressions in the
order_by_clause of the aggregate match by position. Therefore, the number of arguments must be the same and types must be compatible.

■ As an analytic function, DENSE_RANK computes the rank of each row returned
from a query with respect to the other rows, based on the values of the value_exprs in the order_by_clause.
View the Exhibit and examine the structure of ORDERS and CUSTOMERS tables.

Which INSERT statement should be used to add a row into the ORDERS table for the customer
whose CUST LAST NAME is Roberts and CREDIT LIMIT is 600?

A. INSERT INTO orders
VALUES (1,'10-mar-2007', 'direct',
(SELECT customer_id
FROM customers
WHERE cust_last_name='Roberts' AND
credit_limit=600), 1000);

B. INSERT INTO orders (order_id,order_date,order_mode,
(SELECT customer_id
FROM customers
WHERE cust_last_name='Roberts' AND
credit_limit=600) .order_total)
VALUES(1 ,'10-mar-2007', 'direct', &&customer_id, 1000);

C. INSERT INTO orders (order_id.order_date.order_mode,
(SELECT customer_id
FROM customers
WHERE cust_last_name='Roberts' AND
credit _limit=600) .order_total)
VALUES(1 ,'IO-mar-2007', 'direct', &customer_id, 1000);

D. INSERT INTO(SELECT o.order_id, o.order_date.o.orde_mode.c.customer_id, o.order_total
FROM orders o, customers c
WHERE o.customer_id = c.customer_id
AND c.cust_last_name='Roberts'ANDc. Credit_limit=600)
VALUES (1,'10-mar-2007', 'direct',(SELECT customer_id
FROM customers
WHERE cust_last_name='Roberts' AND
Credit_limit=600), 1000);
A
The WHERE clause is used to exclude rows before grouping data - Correct or Incorrect ?
Correct
Which group function computes a total for a group of rows?
SUM
View the Exhibit and examine the structure of the LOCATIONS and DEPARTMENTS tables.

Which SET operator should be used in the blank space in the following SQL statement to display
the cities that have departments located in them?

SELECT location_id, city FROM locations
SELECT location_id, city FROM locations JOIN departments USING(location_id);

A. UNION
B. MINUS
C. INTERSECT
D. UNION ALL
C
Which other function serves the purpose when LTRIM and RTRIM are used together?
TRIM
What is the defining aspect of a SELECT statement that produces a Cartesian product?
The lack of any JOIN criteria
A garment manufacturer maintains three tables with regards to next season's line of men's suits. The three tables are called color, material, and style. Customers can order men's suits made in any of the company's available colors, materials, and styles. Here are a couple of examples you could come up with by selecting one value from each of the three tables:

Color: Dark Blue
Material: Cotton
Style: Italian
Or
Color: Black
Material: Polyester
Style: Double Breasted
Or
Color: Brown
Material: Silk
Style: Zoot

The company needs to create a report for its advertising department that contains all possible combinations of suit colors, materials, and styles.

Which of the following statements is TRUE regarding the SELECT statement that
would accomplish this objective?

You cannot achieve the objective using a single SELECT statement because more than two tables are involved.

Foreign keys need to be established in each table to create parent/child relationships that can be specified in the WHERE clause.

This SELECT statement will not require a WHERE clause because the requirement is to produce a Cartesian cross product.

The use of set operators in the SELECT statement will be required to achiveve the objective
This SELECT statement will not require a WHERE clause because the requirement is to produce a Cartesian cross product
The subquery can reference the columns specified in the parent query - Correct or Incorrect about Correlated Subqueries ?
Correct
The data dictionary view may consist of joins of user-defined tables and dictionary base tables - Correct or Incorrect about VIEWS ?
Incorrect
What will be the result of executing the following SQL statement?

SELECT NULLIF('01-Aug-2008','01-Aug-08') FROM DUAL;

A: 01-Aug-08
B: 01-Aug-2008
C: An ORA error
D: NULL
B: 01-Aug-2008
It is used to form various groups to calculate totals and subtotals created using - ROLLUP and CUBE operators - Correct or Incorrect about GROUPING function ?
Incorrect
What pseudocolumn name is available for use in a hierarchical query which permits you to control the number of generations in the hierarchy which should be selected for output?
LEVEL
What should enclose subqueries?
parentheses
When a table is dropped, the corresponding indexes are automatically dropped - Correct or Incorrect about Indexes ?
Correct
What value is returned after executing the following statement? SELECT TO_CHAR(1234.49, '999999.9') FROM DUAL
1234.5
The columns in a sub query must always be qualified with the name or alias of the table used - True or False ?
FALSE
User account MUSKIE owns a table CBAY. Which of the following statements can be executed by MUSKIE and enable user ONEILL to execute UPDATE statements on the CBAY table?
GRANT ALL ON CBAY TO ONEILL; / GRANT ALL PRIVILEGES TO ONEILL; / GRANT INSERT, UPDATE ON CBAY TO ONEILL
Which option must you include in a GRANT statement if you intend for the user to grant this privilege to other users?
WITH GRANT OPTION
Which statements are correct with reference to granting system privileges?
GRANT CREATE TABLE TO user1, user2; / GRANT CREATE DATABASE TO SYSDBA;
Which should you specify to create a view only if the base tables exist and the owner of the schema containing the view has privileges on them?
NO FORCE
In which of the following data types is data normalized to the database time zone when it is stored in the database?
TIMESTAMP WITH LOCAL TIMEZONE
Which of the following is not required to form a syntactically correct SELECT statement?
A valid name of a column
Which option of the ALTER TABLE statement would you use to mark one or more columns in a table as being obsolete so that they may be dropped later?
SET UNUSED. The syntax is ALTER TABLE tablename SET UNUSED (column);
Which reserved words is not required in order to form a syntactically correct UPDATE statement?
WHERE
Multiple columns or expressions can be compared between the main query and subquery - Correct or Incorrect ?
Correct
It is not possible to designate the same column or combination of columns as both a primary key and a unique key - Correct or Incorrect about UNIQUE constraints ?
Correct
Which of the following reverses the effect of a DROP TABLE operation and can be used to recover after the accidental drop of a table?
Oracle Flashback Drop
When DML statements are logically grouped together as a single entity, what are they collectively called?
Transaction
Indexes are logically and physically independent of the data in the associated table - Correct or Incorrect about Indexes in Oracle ?
Correct
View the Exhibit and examine the description of the DEPARTMENTS and EMPLOYEES tables.

To retrieve data for all the employees for their EMPLOYEE_ID, FIRST_NAME, and
DEPARTMENT NAME, the following SQL statement was written:

SELECT employee_id, first_name, department_name
FROM employees NATURAL JOIN departments;

The desired output is not obtained after executing the above SQL statement.

What could be the reason for this?

A. The NATURAL JOIN clause is missing the
USING clause.

B. The table prefix is missing for the column names in the SELECT clause.

C. The DEPARTMENTS table is not used before the EMPLOYEES table in the FROM clause.

D. The EMPLOYEES and DEPARTMENTS tables have more than one column with the same
column name and data type
D
CURRENT_TIMESTAMP()
CURRENT_TIMESTAMP returns the current date and time in the session time zone, in a value of data type TIMESTAMP WITH TIME ZONE. The time zone offset reflects the current local time of the SQL session. If you omit precision, then the default is 6. The difference between this function and LOCALTIMESTAMP is that CURRENT_TIMESTAMP returns a TIMESTAMP WITH TIME ZONE value while LOCALTIMESTAMP returns a TIMESTAMP value.

In the optional argument, precision specifies the fractional second precision of the time value returned.
View the Exhibit and examine the data in ORDERS_MASTER and MONTHLY_ORDERS tables.

Evaluate the following MERGE statement:

MERGE INTO orders_master o
USING monthly_orders m
ON (o.order_id = m.order_id)
WHEN MATCHED THEN
UPDATE SET o.order_total = m.order_total
DELETE WHERE (m.order_total IS NULL)
WHEN NOT MATCHED THEN
INSERT VALUES (m.order_id, m.order_total);

What would be the outcome of the above statement?

A. The ORDERS_MASTER table would contain the ORDER_IDs 1 and 2.

B. The ORDERS_MASTER table would contain the ORDER_IDs 1,2 and 3.

C. The ORDERS_MASTER table would contain the ORDER_IDs 1,2 and 4.

D. The ORDERS_MASTER table would contain the ORDER IDs 1,2,3 and 4.
C
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. The database contains a table named Employee. You have added many columns to the table and fed data corresponding to each column. You realized that one of the columns in the table needs to be marked as used, which was once marked as unused by you.

Which of the following actions should you take to accomplish the task?

A: You will issue the ALTER TABLE table_name SET USED column_list; statement.

B: You will issue the CREATE TABLE table_name SET UNUSED column_list TO USED
column_list; statement.

C: You will drop the unused column and recreate it.

D: You will issue the CREATE TABLE table_name SET USED column_list; statement
C: You will drop the unused column and recreate it
What are functions that operate on sets of rows to give one result per group called?
group functions, or aggregate functions
The physician table contains these columns:

physician_id NUMBER NOT NULL PK
last_name VARCHAR2(30) NOT NULL
first_name VARCHAR2(25) NOT NULL
license_no NUMBER(7) NOT NULL
hire_date DATE

When new physician records are added, the physician_id is assigned a sequential value using the phy_num_seq sequence. The state licensing board assigns license numbers with valid license numbers being from 1000000 to 9900000.

You want to create an INSERT statement that will prompt the user for each physician's name and license number and insert the physician's record into the physician table with a hire date of today. The statement should generate an error if an invalid license number is entered.

Which INSERT statement should you use?

INSERT INTO physician
VALUES (phy_num_seq.NEXTVAL, '&lname', '&fname', &lno, sysdate)
WHERE &lno BETWEEN 1000000 and 9900000;

INSERT INTO physician
VALUES (phy_num_seq.NEXTVAL, '&lname', '&fname', &lno BETWEEN 1000000 and
9900000, sysdate);

INSERT INTO
(SELECT physician_id, last_name, first_name, license_no, hire_date
FROM physician
WHERE license_no BETWEEN 1000000 and 9900000 WITH CHECK OPTION)
VALUES (phy_num_seq.VALUE, '&lname', '&fname', &lno, sysdate);

INSERT INTO
(SELECT physician_id, last_name, first_name, license_no, hire_date FROM physician
WHERE license_no BETWEEN 1000000 and 9900000 WITH CHECK OPTION)
VALUES (phy_num_seq.NEXTVAL, &lname, &fname, &lno, sysdate);

INSERT INTO
(SELECT physician_id, last_name, first_name, license_no, hire_date FROM physician
WHERE license_no BETWEEN 1000000 and 9900000 WITH CHECK OPTION)
VALUES (phy_num_seq.NEXTVAL, '&lname', '&fname', &lno, sysdate);

INSERT INTO
(SELECT physician_id, last_name, first_name, license_no, hire_date FROM physician
WHERE license_no BETWEEN 1000000 and 9900000 WITH CHECK OPTION)
VALUES (&phy_num_seq, '&lname', '&fname', &lno, sysdate);
INSERT INTO
(SELECT physician_id, last_name, first_name, license_no, hire_date FROM physician
WHERE license_no BETWEEN 1000000 and 9900000
WITH CHECK OPTION)
VALUES (phy_num_seq.NEXTVAL, '&lname', '&fname', &lno, sysdate);
Meta Character used to ensure that a character is not in the list --
[^ ]
You need to create a view that displays the ORDER ID, ORDER_DATE, and the total number of items in each order.

Which CREATE VIEW statement would create the view successfully?

A. CREATE OR REPLACE VIEW ord_vu (order_id,order_date)
AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id) "NO OF ITEMS" FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date;

B. CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id)
"NO OF ITEMS" FROM orders o JOIN order_items i
ON (o.order_id = i.order_id)
GROUP BY .order_id,o.order_date;

C. CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id)
FROM orders o JOIN order_items i ON (o.order_id = i.order_id) GROUP BY o.order_id,o.order_date;

D. CREATE OR REPLACE VIEW ord_vu AS SELECT o.order_id, o.order_date, COUNT(i.line_item_id)ll' NO OF ITEMS' FROM orders o JOIN order_items i
ON (o.order_id = i.order_id)
GROUP BY o.order_id,o.order_date
WITH CHECK OPTION;
B
The outer query can be any DML or SELECT SQL statement - Correct or Incorrect regarding Correlated Subquery ?
Incorrect
To check the system level privileges that have been granted to PUBLIC users, which data dictionary views will you query?
DBA_SYS_PRIVS
You work as a Database Developer for Gadgets Inc. The company uses Oracle as its
database. The database contains a table named Employee. You want to retrieve the address of all those employees who provide technical support and have joined after the year 2007.

Which of the following queries will you use to accomplish the task?

A: SELECT emp_add FROM employee WHERE job_desig = 'tech_support' AND join_date
> 31-dec-2007;

B: SELECT emp_add FROM employee WHERE job_desig = 'tech_support' AND join_date
> '31-dec-2007';

C: SELECT emp_add FROM employee WHERE job_desig = 'tech_support' OR join_date
> '31-dec-2007';

D: SELECT emp_add FROM employee WHERE
job_desig = 'tech_support' OR join_date
> 31-dec-2007;
B: SELECT emp_add FROM employee WHERE job_desig = 'tech_support' AND join_date > '31-dec-2007';
Which are the two types of characters that a user should use to specify regular expression?
Metacharacters and literals
Can a column be referenced in an ON clause before the column's table has been specified?
No
Which clauses should you use to order rows of siblings of the same parent?
ORDER SIBLINGS BY
Which system privileges should you have to create a private synonym in another user's schema?
CREATE ANY SYNONYM
TO_DATE may convert date items to character items - Correct or Incorrect ?
Incorrect
In a hierarchical query, is it possible for a row to have more than one immediate ancestor?
No
A subquery cannot be used in the GROUP BY clause of a SELECT statement - True or False ?
1
Multiple-row subqueries should not be used with the NOT IN operator in the main query if NULL is likely to be a part or the result of the subquery - True or False ?
1
An owner of an object can grant access to all users using which keyword?
PUBLIC
You have used meta-data to view privileges for a set of tables in the database. Which of the following terminologies can be used as a synonym for metadata?
System catalog / Data dictionary
The WITH CHECK OPTION constraint can be used in a view definition to restrict the columns displayed through the view - Correct or Incorrect about VIEWS ?
Incorrect
Which system privilege may be granted to a role?
BACKUP ANY TABLE
How can you override operator precedence?
by including parentheses in the expression
Which comparison operator compares a value to each value returned by a subquery?
ANY
If a composite primary key is required, the PRIMARY KEY constraint must be defined at what level?
the table level
On which queries is a correlated subquery dependent?
Outer query
It is not possible to designate the same column or combination of columns as both a primary key and a unique key - Correct or Incorrect about Primary Key Constraint ?
Correct
Which datatype stores lengths of time represented in days, hours, minutes, and seconds?
INTERVAL DAY TO SECOND
In an INSERT statement, how can you specify that a NULL value is to be inserted into a column?
omit the column in the column list OR explicitly include the NULL keyword in the INSERT statement's VALUES clause
If a table is dropped, there is no effect on all the associated indexes - Correct or Incorrect about Indexes in Oracle ?
Incorrect
What type of information is stored in the database regarding an External Table and where is that information stored?
the metadata, which is stored in the data dictionary
NOT NULL constraints are supported for a column or attribute whose type is userdefined object, VARRAY, REF, or LOB - Correct or Incorrect about NOT NULL constraint ?
Correct
GROUP_ID()
GROUP_ID distinguishes duplicate groups resulting from a GROUP BY specification. It
is useful in filtering out duplicate groupings from the query result. It returns an Oracle NUMBER to uniquely identify duplicate groups. This function is applicable only in a SELECT statement that contains a GROUP BY clause.

If n duplicates exist for a particular grouping, then GROUP_ID returns numbers in the range 0 to n-1

To ensure that only rows with GROUP_ID < 1 are returned, add the following HAVING clause to the end of the statement :
HAVING GROUP_ID() < 1
You have used the TO_CHAR function to display a date field with the day, month and year
spelt out.

Which format model will you use to truncate leading and trailing blank spaces in the output?

A: YEAR
B: DAY
C: FM
D:MONTH
C: FM
Consider that a hierarchical query has the START WITH clause and a CONNECT BY PRIOR clause specified to generate a tree-structured output.

What will happen if the START WITH clause returns multiple rows?

A: Oracle will only display the root rows without any tree-structure.

B: Oracle will give an error.

C: Oracle will process multiple hierarchies under each root row.

D: Oracle will take the first row as the root row
C: Oracle will process multiple hierarchies under each root row.
David is an employee in Gentech Inc. The company uses an Oracle database. David has
been granted a role named Sales. David wants to drop the role.

He executes the following statement to accomplish this:

DROP ROLE Sales;

When he executes the statement, it returns an error. What is the most likely cause of the issue?

Each correct answer represents a complete solution. Choose two.

A: David is not granted the role with the ADMIN OPTION.

B: Only the database administrator can drop the role.

C: David is not granted the role with the GRANT OPTION.

D: David does not have the DROP ANY ROLE system privilege
A: David is not granted the role with the ADMIN OPTION

D: David does not have the DROP ANY ROLE system privilege
You want to retrieve the first name, the last name, and the joining month of all employees whose joining month is May. Which queries will you use to accomplish the task?
SELECT first_name, last_name, EXTRACT (MONTH FROM join_date) FROM Employee WHERE EXTRACT (MONTH FROM join_date) = 5;
An external table named contract_employees provides data for the employees table in a database. The following statement is executed for the external table:

DROP TABLE contract_employees;

Which of the following statements is TRUE about the DROP TABLE statement?

The DROP TABLE statement removes only the external table from the database.

The DROP TABLE statement removes only the metadata of the external table from the database.

The DROP TABLE statement removes the external table and its metadata from the database.

The DROP TABLE statement removes neither the external table nor its metadata from the database.
The DROP TABLE statement removes only the metadata of the external table from the database.
If the subquery returns more than one row, then an error occurs - Correct or Incorrect about Scaler Subquery ?
Correct
View the Exhibit and examine the description of the PRODUCT_INFORMATION table.

You want to display the expiration date of the warranty for a product.

Which SQL statement would you execute?

A. SELECT product_id, SYSDATE + warranty_period FROM product_information;

B. SELECT product_jd, TO_YMINTERVAL(warranty_period) FROM product_information;

C. SELECT product_id, TO_YMINTERVAL(SYSDATE) + warranty_period
FROM product_information;

D. SELECT product_jd, TO_YMINTERVAL(SYSDATE + warranty_period)
FROM product_information;
A
Which are SQL regular expression function?
REGEXP_LIKE / REGEXP_INSTR / REGEXP_SUBSTR
Which type of join containing an equality operator joins two tables by a column that contains a matching value?
an equijoin
Name three functions that can be used with group functions to replace NULL values
NVL, NVL2, and COALESCE
The ORDER SIBLINGS BY clause should be used to order rows of siblings of the same parent - Correct or Incorrect about Hierarchial Retrieval ?
Correct
You are the owner of Sales and Orders tables. You issue the following GRANT command:

GRANT ALL
ON Sales, Orders
TO PUBLIC;

What will you do to correct the above statement?

A: Separate GRANT statements are required for Sales and Orders tables.

B: PUBLIC should be replaced with specific usernames.

C: WITH GRANT OPTION should be added to the statement.

D: No correction is required for the above GRANT statement.
A: Separate GRANT statements are required for Sales and Orders tables
Sequences can be used to automatically generate primary key values - Correct or Incorrect about Sequences ?
Correct
Which can help in creating a report using tree branching methods?
Hierarchical queries
When implementing a natural join, must columns with the same names have compatible datatypes?
Yes
A subquery that includes references back to the parent query, and thus cannot execute as a standalone query, is:
A correlated subquery
They always contain a subquery within a subquery - True or False regarding Multiple-row Subquery ?
1
All date functions return DATE data type values - True or False ?
1
Which statements is used to enable a role?
SET ROLE
A user should have the CREATE SEQUENCE system privilege to create a sequence in his own schema - Correct or Incorrect about Sequences ?
Correct
Which one of the following data dictionary views will contain the object privileges you have on tables owned by other users?
USER_TAB_PRIVS_RECD
Which operators is used as a not equal operator in Oracle 11g?
<>
A B-tree index has a typical inverted-tree structure - Correct or Incorrect about B-Tree Index ?
Correct
How many digits to the right of the decimal point are allowed for a column defined as NUMBER(7,3)?
three
The EXIST condition can be used in the FROM clause of the SQL statement - Correct or Incorrect ?
Incorrect
What would you use to force the order of evaluation of set operators in a compound query?
parentheses
Valid column and table names should begin with what?
an alphabetic character
Which category of SQL statements control access/permission to the data?
DCL statements, such as GRANT and REVOKE, control access to data.
Which SQL capability allows you to control the number of columns returned by a query by choosing the columns in the SELECT clause?
projection
What is the primary difference between an index organized table and a regular (heap) table?
In the index organized table, the rows are physically stored in order by the primary key
Explain the difference between disabling and dropping a constraint
A constraint than has been disabled still exists but is not enforced. It can be reenabled a later time. If a constraint is dropped, it will need to be recreated should you need it again
The unique key cannot contain a column of TIMESTAMP WITH LOCAL TIME ZONE - Correct or Incorrect about UNIQUE constraints ?
Incorrect
Which two SQL statements add rows of data to an existing table?
the INSERT and MERGE statements
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) which stores the employee name
3. Hire date, to store the date when the employee joined the organization
4. Status (character data type). It should contain the value if no data is entered.
5. Resume (character large object [CLOB] data type), which would contain the resume submitted
by the employee

Which is the correct syntax to create this table?

A. CREATE TABLE EMP_1
(emp_id NUMBER(4),
emp_name VARCHAR2(25),
start_date DATE,
e_status VARCHAR2(10) DEFAULT ACTIVE',
resumeCLOB(200));

B. CREATE TABLE 1_EMP
(emp_id NUMBER(4),
emp_name VARCHAR2(25),
start_date DATE,
emp_status VARCHAR2(10) DEFAULT ACTIVE',
resume CLOB);

C. CREATE TABLE 1_EMP
(emp_id NUMBER(4),
emp_name VARCHAR2(25), start_date DATE,
emp_status VARCHAR2(10) DEFAULT "ACTIVE",
resume CLOB);

D. CREATE TABLE EMP_1
(emp_id NUMBER, emp_name VARCHAR2(25),
start_date DATE,
emp_status VARCHAR2(10) DEFAULT ACTIVE',
resume CLOB);
D
Which of the queries given below will sort the result set by ENAME in ascending order?

Each correct answer represents a complete solution. Choose all that apply.

A: SELECT ENAME, SAL FROM EMP ORDER BY auto;

B: SELECT ENAME, SAL FROM EMP ORDER BY 1;

C: SELECT ENAME, SAL FROM EMP ORDER BY;

D: SELECT ENAME, SAL FROM EMP ORDER BY ENAME;
B: SELECT ENAME, SAL FROM EMP ORDER BY 1;

D: SELECT ENAME, SAL FROM EMP ORDER BY ENAME;
Evaluate the following ALTER TABLE statement:

ALTER TABLE Sales
SET UNUSED sales_date;

Which of the following statements are true?

Each correct answer represents a complete solution. Choose all that apply.

A: The sales_date column should be empty for the ALTER TABLE command to execute
successfully.

B: ROLLBACK can be used to get back the sales_date column in the Sales table.

C: The DESCRIBE command would still display the sales_date column.

D: After executing the ALTER TABLE command, you can add a new column called
ORDER_DATE to the ORDERS table.

E: A SELECT * query will not retrieve data from unused columns
D: After executing the ALTER TABLE command, you can add a new column called ORDER_DATE to the ORDERS table.

E: A SELECT * query will not retrieve data from unused columns
RAWTOHEX()
RAWTOHEX()

RAWTOHEX converts raw to a character value containing its hexadecimal representation.

As a SQL built-in function, RAWTOHEX accepts an argument of any scalar data type other than LONG, LONG RAW, CLOB, BLOB, or BFILE. It returns a VARCHAR2 value with the hexadecimal representation of bytes that make up the value of raw. Each byte is represented by two hexadecimal digits.
A Correlated sub-query references a column of a table referred in the outer query - Correct or Incorrect regarding Correlated Subquery ?
Correct
The EMP table contains all the details of the employees and the EMP_BONUS_2009
table contains the new salary for employees including their performance bonuses for
the year 2009.

Which of the following queries should you use to update the SAL column of the EMP table with the new SAL values from the EMP_BONUS_2009 table?

A: UPDATE EMP A
SET A.SAL= (SELECT B.SAL FROM EMP_BONUS_2009 B);

B: UPDATE EMP
SET SAL= (SELECT B.SAL FROM EMP_BONUS_2009 B
WHERE EMPNO=B.EMPNO);

C: UPDATE EMP A
SET B.SAL= (SELECT A.SAL FROM EMP_BONUS_2009 B
WHERE A.EMPNO=B.EMPNO);

D: UPDATE EMP A
SET A.SAL= (SELECT B.SAL FROM EMP_BONUS_2009 B
WHERE A.EMPNO=B.EMPNO);
D: UPDATE EMP A
SET A.SAL= (SELECT B.SAL FROM EMP_BONUS_2009 B WHERE A.EMPNO=B.EMPNO);
Which meta characters matches any character in the list of supported character set?
. (dot)
Which two clauses of the SELECT statement facilitate selection and projection?
SELECT, WHERE
A hierarchical query can further be refined by using the CONNECT_BY_ROOT operator - Correct or Incorrect about Hierarchial Retrieval ?
Correct
SCOTT is a user in the database.

Evaluate the commands issued by the DBA:

1 - CREATE ROLE mgr;
2 - GRANT CREATE TABLE, SELECT
ON oe. orders TO mgr;
3 - GRANT mgr, create table TO SCOTT;

Which statement is true regarding the execution of the above commands?

A. Statement 1 would not execute because the WITH GRANT option is missing.

B. Statement 1 would not execute because the IDENTIFIED BY <password> clause is missing.

C. Statement 3 would not execute because role and system privileges cannot be granted together
in a single GRANT statement.

D. Statement 2 would not execute because system privileges and object privileges cannot be
granted together in a single GRANT command.
D
In which two clauses of the SELECT statement can you use a subquery?
FROM / WHERE
Examine the following SQL statement:

SELECT order_id, product_id, unit_price FROM order_jtems
WHERE unit_price = (SELECT MAX(unit_price)
FROM order_items
GROUP BY order_id);

You want to display the PRODUCT_ID of the product that has the highest UNIT_PRICE per ORDER_ID.

What correction should be made in the above SQL statement to achieve this?

A. Replace = with the IN operator.

B. Replace = with the >ANY operator.

C. Replace = with the >ALL operator.

D. Remove the GROUP BY clause from the subquery and place it in the main query
A
Synonyms are used to reference only those tables that are owned by another user - Correct or Incorrect about SYNONYMS ?
Incorrect
Which parameters of hierarchical query specifies the root row(s) of the hierarchy?
START WITH
It's an extension of the GROUP BY clause - Correct or Incorrect about ROLLUP operation ?
Correct
Populate a new table at the time it is created with data found elsewhere in the database - Can it be accomplished with a Subquery ?
Yes
It calculates four subtotals for three grouping columns - Correct or Incorrect about ROLLUP operation ?
Correct
In which clauses of a SELECT statement can a scalar subquery be used?
HAVING, ORDER BY, WHERE
What value is returned after executing the following statement: SELECT LENGTH('How_long_is_a_piece_of_string?') FROM DUAL;
B
For each DML operation performed, the corresponding indexes are automatically updated - Correct or Incorrect about Indexes ?
Correct
What are the two types of privileges that can be granted to any user?
Object privilege / System privilege
Which of the following SET operators displays distinct records in the final combined result set by eliminating duplicate rows?
UNION
You can create synonyms on objects only that you own - Correct or Incorrect about Synonyms ?
Incorrect
TO_CHAR (character)
TO_CHAR (character)

TO_CHAR (character) converts NCHAR, NVARCHAR2, CLOB, or NCLOB data to the
database character set. The value returned is always VARCHAR2.

When you use this function to convert a character LOB into the database character set, if the LOB value to be converted is larger than the target type, then the database returns an error.

You can use this function in conjunction with any of the XML functions to generate a date in the database format rather than the XML Schema standard format.

The following example interprets a simple string as character data:

SELECT TO_CHAR('01110') FROM DUAL;
TO_CH
-----
01110
Which is a type of subquery that contains a reference to one or more columns in the outer query?
Correlated subquery
The set operators do not include which one of the keywords:( ALL, SET, MINUS, UNION )
SET
Only one long column can be used per table - True or False about Oracle data Types ?
1
Which SQL capability allows you to choose rows in a table to be returned by a query?
selection
If the statement SELECT * FROM emp WHERE UPPER(last_name) = :x; was executed many times in your application, what would you consider doing to improve performance?
Build a function based index on UPPER(last_name).
Which objects is used to compare object instances and perform operations that do not use the data of any particular object?
Static method
Which of the following parameters controls the maximum number of ITLs that a block can allocate?
MAXTRANS
The unique key can be specified only for the top-level (root) view - Correct or Incorrect about UNIQUE constraints ?
Correct
Which DML statement only adds rows to a table?
INSERT
An unused column can be seen by the users of the table - Correct or Incorrect about UNUSED column ?
Incorrect
Henry is the database administrator for a mobile service provider. The service provider has been offering unlimited data plans on its smartphones. It has recently decided to limit data per billing cycle to 5 GB, with an overage charge for customers who exceed that limit. An existing table called customers is described below:

SQL> DESCRIBE customerS
id NUMBER(7)
name VARCHAR2(25)
voice_min NUMBER(8)
data NUMBER(9)

Because of this policy change, a column called data_overage needs to be added to customers.

Henry added this column to the customers table, and also created an index on the data_overage column:

SQL> ALTER TABLE customers ADD (data_overage NUMBER(8));

SQL> CREATE INDEX data_overage_indx ON customers(data_overage);

Three months later, due to customer complaints, the policy was changed back to unlimited data access per month, and so there was no longer a need to keep track of any sort of overage for each customer.

Henry issued new code to reverse the previous policy:

SQL> ALTER TABLE customers SET UNUSED (data_overage);

ROLLBACK;

SELECT id, name, data_overage FROM customers;

ALTER TABLE customers ADD COLUMN data_overage NUMBER (8);

ALTER TABLE Customers DROP UNUSED COLUMNS;

Which of the following statements are TRUE due to the commands issued in the block immediately above? (Choose two.)

The data_overage_indx index is dropped.

The data_overage column is made usable because of the ROLLBACK statement.

The data in the data_overage column is displayed by the SELECT statement.

The data_overage column is dropped from the table by the DROP UNUSED COLUMNS clause of the ALTER TABLE statement.
The data_overage_indx index is dropped.

The data_overage column is dropped from the table by the DROP UNUSED COLUMNS clause of the ALTER TABLE statement
The line_item table contains these columns:

line_itemid NUMBER(9)
order_id NUMBER(9)
product_id VARCHAR2(9)
quantity NUMBER(5)

You created a sequence called line_itemid_seq to generate sequential values for the line_itemid column.

Evaluate this SELECT statement:

SELECT line_itemid_seq.CURRVAL
FROM dual;

Which task will this statement accomplish?

increments the line_itemid column

displays the next value of the line_itemid_seq sequence

displays the current value of the line_itemid_seq sequence

populates the line_itemid_seq sequence with the next value
displays the current value of the line_itemid_seq sequence
LTRIM()
LTRIM removes from the left end of char all of the characters contained in set. If you do not specify set, then it defaults to a single blank. If char is a character literal, then you must enclose it in single quotation marks. Oracle Database begins scanning char from its first character and removes all characters that appear in set until reaching a
character not in set and then returns the result.

Both char and set can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The string returned is of VARCHAR2 data type if char is a character data type, NVARCHAR2 if char is a national character data type, and a LOB if char is a LOB data type.

The following example trims all the left-most occurrences of less than sign (<), greater
than sign (>) , and equal sign (=) from a string:

SELECT LTRIM('<=====>BROWNING<=====>', '<>=') "LTRIM Example" FROM DUAL;

LTRIM Example
---------------
BROWNING<=====>
The ACCOUNT table contains these columns:

account_id NUMBER(12)
new_balance NUMBER(7,2)
PREV_BALANCE NUMBER(7,2)
FINANCE_CHARGE NUMBER(7,2)

You need to create a single SELECT statement to accomplish these requirements:

z Display accounts that have a new balance that is less than the previous balance.
z Display accounts that have a finance charge that is less than $25.00.
z Display accounts that have no finance charge.

Evaluate this statement:

SELECT account_id
FROM account
WHERE new_balance < prev_balance
AND NVL(finance_charge, 0) < 25;

How many of the three requirements above will this SELECT statement satisfy?

all of the requirements

one of the requirements

two of the requirements

none of the requirements
all of the requirements
Which regular expression function can be used with a CHECK constraint on a column of a table in order to insure the specific format of the data entered for that column?
REGEXP_LIKE
Must a HAVING clause be preceded by a GROUP BY clause?
No, a HAVING clause can be listed first, but it is usually placed after the GROUP BY clause
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its
database. The database contains a table named Employee. The table contains employee names, White, Whyte, Bright, and Fright.

You issue the following SQL statement:

SELECT last_name
FROM employee
WHERE SOUNDEX(last_name) = SOUNDEX('Whyte');

What will be the result of the above SQL statement?

Each correct answer represents a complete solution. Choose two.

A: Bright
B: Fright
C: White
D: Whyte
C: White
D: Whyte
Which Flashback Version Query (FVQ) pseudocolumns identifies the transaction that created the row?
VERSIONS_XID
Which of the following options will produce the same result set as the given SQL query?

SQL> SELECT * FROM DEPT A
2 WHERE A.DEPTNO NOT IN (SELECT A.DEPTNO FROM EMP A);

A: SELECT * FROM DEPT A WHERE NOT EXISTS (SELECT 'X' FROM EMP B
WHERE A.DEPTNO = B.DEPTNO);

B: SELECT * FROM DEPT A WHERE NOT EXISTS (SELECT 'X' FROM EMP B);

C: SELECT * FROM DEPT A WHERE EXISTS (SELECT 'X' FROM EMP B WHERE A.DEPTNO=B.DEPTNO);

D: SELECT * FROM DEPT A WHERE EXISTS (SELECT 'X' FROM EMP B WHERE A.DEPTNO != B.DEPTNO);
A: SELECT * FROM DEPT A WHERE NOT EXISTS (SELECT 'X' FROM EMP B WHERE A.DEPTNO = B.DEPTNO);
Column-to-column comparison and row-to-row comparison takes place in the multiple-column subquery - Correct or Incorrect about Multiple Column Subquery ?
Correct
Oracle returns an error if the CONNECT BY condition results in a loop in the hierarchy - Correct or Incorrect about Hierarchial Retrieval ?
Correct
You are maintaining the database of students in a public school. You execute the following set of statements:

CREATE TABLE students
(student_id VARCHAR2(50) PRIMARY KEY,
score NUMBER (10));

INSERT INTO students VALUES ('S001', 300);

INSERT INTO students VALUES ('S002', 90);

COMMIT;

UPDATE students SET score=score*1.5;

COMMIT;

DELETE FROM students WHERE score<150;

COMMIT;

ROLLBACK;

INSERT INTO students VALUES ('S002', 200);

COMMIT;

SELECT student_id, score, versions_starttime, versions_endtime, versions_operation
FROM students
versions BETWEEN timestamp MINVALUE AND MAXVALUE
WHERE student_id='S002';

Which of the following is TRUE about the result of the given set of statements? (Choose all that apply.)

A new version of a row is created when the COMMIT statement is executed.

All the versions of the row having S002 as student_id are displayed with one row for each version.

The versions_operation pseudocolumns not include the DELETE operation on the row having S002 as student_id because the operation is rolled back.

The versions_endtime pseudocolumn has NULL value for the second INSERT operation on the row
having S002 as with student_id.
A new version of a row is created when the COMMIT statement is executed.

All the versions of the row having S002 as student_id are displayed with one row for each version.
Which type of join joins two tables when the column in one table does not directly correspond to a column in the second table?
a non-equijoin
It produces n+1 possible superaggregates combinations if the n columns and expressions are specified in the GROUP BY clause - Correct or Incorrect regarding CUBE operator ?
Incorrect
They use the < ALL operator to imply less than the maximum - True or False regarding Multiple-row Subquery ?
1
Which should you perform if you want to display data from more than one table?
Join
Review this SQL statement: SELECT MONTHS_BETWEEN(LAST_DAY('15-JAN-12')+1,'01-APR-12')FROM DUAL; What will result from the query above?
-2
Which character function returns an occurrence of one string of characters within a column value or expression?
INSTR. The syntax of the INSTR function is INSTR(column|expression, 'string' [, m] [, n])
The REVOKE command can be used to remove privileges but not roles from other users - Correct or Incorrect about ROLES ?
Incorrect
When combining two SELECT statements, which of the set operators ( MINUS,UNION ALL,INTERSECT,UNION) will produce a different result,depending on which SELECT statement precedes or follows the operator?
MINUS
You use the PUBLIC keyword in CREATE SYNONYM command to restrict access to specified users - Correct or Incorrect about Synonyms ?
Incorrect
UID()
UID()

UID returns an integer that uniquely identifies the session user (the user who logged on).

The following example returns the UID of the current user:

SELECT UID FROM DUAL;
By default, how is the output of the UNION set operator sorted?
It is sorted ascending in the order of the columns in the first SELECT list.
When the MAXVALUE limit for a sequence is reached, you can increase the MAXVALUE limit by using the ALTER SEQUENCE statement - Correct or Incorrect about Sequences created in a single instance database ?
Correct
When a column is dropped using the DROP COLUMN clause of the ALTER TABLE statement, which columns are physically dropped?
the specified column and any other columns of that table that have been marked as UNUSED are dropped
What is the default state of a constraint when it is first added to a table?
ENABLE VALIDATE
Which views shows all the tables in a database?
DBA_TABLES
For which two types of constraints will a unique index be automatically created?
UNIQUE, PRIMARY KEY
The attributes specified when an external table is created are ---
TYPE / LOCATION / DEFAULT DIRECTORY / ACCESS PARAMETERS
Which statement explicitly makes all pending data modifications permanent?
the COMMIT statement
Which system privileges should you have to create function-based indexes on tables in your own schema?
Query rewrite
Which of the following keywords should follow the input data in the INSERT statement if you want to manually insert data in a table by using the INSERT statement?
VALUES
View the Exhibit and examine the details of the PRODUCT_INFORMATION table.

You have the requirement to display PRODUCT_NAME and LIST_PRICE from the table where the CATEGORYJD column has values 12 or 13, and the SUPPLIER_ID column has the value 102088.

You executed the following SQL statement:

SELECT product_name, list_price
FROM product_information
WHERE (category_id = 12 AND category_id = 13) AND supplier_id = 102088;

Which statement is true regarding the execution of the query?

A. It would execute but the output would return no rows.

B. It would execute and the output would display the desired result.

C. It would not execute because the entire WHERE clause condition is not enclosed within the parentheses.

D. It would not execute because the same column has been used in both sides of the AND logical
operator to form the condition
A
NUMTOYMINTERVAL()
NUMTOYMINTERVAL()

NUMTOYMINTERVAL converts number n to an INTERVAL YEAR TO MONTH literal. The
argument n can be any NUMBER value or an expression that can be implicitly converted
to a NUMBER value. The argument interval_unit can be of CHAR, VARCHAR2,NCHAR, or NVARCHAR2 data type. The value for interval_unit specifies the unit of n and must resolve to one of the following string values:
■ 'YEAR'
■ 'MONTH'

interval_unit is case insensitive. Leading and trailing values within the parentheses are ignored. By default, the precision of the return is 9.
You work as a Database Developer for Dolliver Inc. The company uses Oracle 11g as its
database. The company implements its incentive policy for only those employees who have completed six months of work or are contributing exceptionally well to the company. The company's database contains a table named Employee. You want to retrieve the records of all those employees who are not eligible for the incentive policy.

Which of the following SQL commands can you use to accomplish the task?

Each correct answer represents a complete solution. Choose two.

A: SELECT * FROM EMPLOYEE WHERE Emp_incentive ISNULL;

B: SELECT * FROM EMPLOYEE WHERE Emp_incentive = NULL;

C: SELECT * FROM EMPLOYEE WHERE NOT(Emp_incentive IS NOT NULL);

D: SELECT * FROM EMPLOYEE WHERE Emp_incentive IS NULL;
C: SELECT * FROM EMPLOYEE WHERE NOT(Emp_incentive IS NOT NULL);

D: SELECT * FROM EMPLOYEE WHERE Emp_incentive IS NULL;
While maintaining the database for a public bus service provider, you observe that data retrieval is taking a long time. You must speed up the data retrieval process as well as ensure that each bus (bus) has an ID (busid) with a unique value.

Which of the following statements should you use to achieve the desired result?

ALTER TABLE businfo ADD UNIQUE(busid);

ALTER TABLE businfo ADD PRIMARY KEY(busid);

CREATE INDEX bus_index ON businfo(busid);

CREATE UNIQUE INDEX bus_index ON businfo(busid);
ALTER TABLE businfo ADD PRIMARY KEY(busid);
What will be the output of the following query? SELECT ABS(FLOOR(-268651.894)) FROM DUAL;
268652
You work as a Database Developer for Gadgets Inc. The company uses Oracle as its
database. The database contains a table named Employee. You are using iSQL*Plus interface to write your queries. You want to retrieve employee_id, last_name, salary,and department_id from the Employee table and also want iSQL*Plus to prompt for the employee_id.

Which of the following characters will you use as a substitution variable to hold employee_id?

Each correct answer represents a complete solution. Choose two.

A: &
B: #
C: *
D: @
E: &&
A: &

E: &&
Which statements correctly describes an inline view?
A subquery in the FROM clause of a SELECT statement
Which of the following queries will provide EMPID and SAL of the employee earning the
maximum salary?

A: SELECT EMPID, SAL FROM EMP WHERE SAL=MAX (SAL);

B: SELECT EMPID, SAL FROM EMP WHERE SAL= (SELECT MAX (SAL) FROM EMP);

C: SELECT EMPID, SAL FROM EMP HAVING SAL=MAX (SAL);

D: SELECT MAX (SAL) FROM EMP;
B: SELECT EMPID, SAL FROM EMP WHERE SAL=
(SELECT MAX (SAL) FROM EMP);
When the DESC keyword is included in an ORDER BY clause, where will NULL values be displayed?
first
You work as a Database Developer for Dolliver Inc. The company uses Oracle as its
database. The database contains a table named Employee. You want to retrieve the first name, the last name, and the joining month of all employees whose joining month is May.

Which of the following queries will you use to accomplish the task?

A: SELECT first_name, last_name, EXTRACT (MONTH FROM join_date) WHERE
EXTRACT (MONTH FROM join_date) = 5;

B: SELECT first_name, last_name, EXTRACT (MONTH FROM join_date) FROM Employee
WHERE EXTRACT (MONTH FROM join_date) = 5;

C: SELECT first_name, last_name, EXTRACT (MONTH FROM join_date) FROM Employee
WHERE EXTRACT (MONTH FROM join_date) = May;

D: SELECT first_name, last_name FROM Employee WHERE EXTRACT (MONTH FROM
join_date) = 5;
B: SELECT first_name, last_name, EXTRACT (MONTH FROM join_date) FROM Employee
WHERE EXTRACT (MONTH FROM join_date) = 5;
Which aggregate functions can be used on character data?
COUNT / MIN
It calculates aggregates - Correct or Incorrect about ROLLUP operation ?
Correct
In which clauses of a SELECT statement do the ROLLUP and CUBE operators work?
GROUP BY
What kind of join automatically joins two or more tables based on common column names?
Natural Join
Review this SQL statement: SELECT SUBSTR('2009',1,2) || LTRIM('1124','1') FROM DUAL; What will be the result of the SQL statement?
2024
Which types of views will provide information about objects that a user owns and has access to?
ALL_*
A query cannot contain more than one sub-queries - True or False ?
1
Indexes help reduce Disk input/output (I/O) - Correct or Incorrect about Indexes ?
Correct
You want to convert the 20.345 string and add 64.187 numeric value to 20.345. Which SQL statements will you use to accomplish the task?
SELECT to_number('20.345') + 64.187 FROM DUAL;
LAST_DAY()
LAST_DAY returns the date of the last day of the month that contains date. The last day of the month is defined by the session parameter NLS_CALENDAR. The return type is always DATE, regardless of the data type of date.

The following statement determines how many days are left in the current month.

SELECT SYSDATE, LAST_DAY(SYSDATE) "Last", LAST_DAY(SYSDATE) - SYSDATE "Days Left" FROM DUAL;

SYSDATE Last Days Left
--------- --------- ----------
30-MAY-09 31-MAY-09 1
What are the two requirements of expressions in a SELECT list in a compound query?
the expressions must match in number and in datatype
This statement will fail: create unique bitmap index on employees(department_id,hire_date); Why?
Bitmap indexes cannot be unique.
GRANT CREATE SESSION TO ALL - Correct or Incorrect ?
Incorrect
Which views list tables that have partially completed DROP COLUMN operations?
ALL_PARTIAL_DROP_TABS, USER_PARTIAL_DROP_TABS, DBA_PARTIAL_DROP_TABS
Which data types is stored by Oracle for future use?
VARCHAR
Which SELECT capability is used to retrieve columns in a table?
Projection
If SYSDATE returns 12-JUL-2009, what is returned by the following statement? SELECT DECODE(TO_CHAR(SYSDATE,'MM'),'02','TAX DUE','PARTY') FROM DUAL;
PARTY
Does one DML statement constitute a complete database transaction?
No, one DDL or DCL statement constitutes a complete database transaction, but a transaction can contain more than one DML statement.
External tables can return a different number of rows depending on what columns are queried - Correct or Incorrect about EXTERNAL tables ?
Correct
Which two DML statements could you use to modify the contents of the PRODUCT_NAME column of the existing PRODUCT table?
MERGE / UPDATE
Which data dictionary views lists all the roles that are enabled in a session?
SESSION_ROLES
CEIL()
CEIL returns the smallest integer that is greater than or equal to n. Thus, the value of CEIL is n itself if and only if n is precisely an integer.

This function takes as an argument any numeric data type or any nonnumeric data
type that can be implicitly converted to a numeric data type.
The function returns the same data type as the numeric data type of the argument.

The following example returns the smallest integer greater than or equal to the order total of a specified order:

SELECT order_total, CEIL(order_total)
FROM orders WHERE order_id = 2434;
ORDER_TOTAL CEIL(ORDER_TOTAL)
----------- -----------------
268651.8 268652
You want to display all employees and their managers having 100 as the MANAGER_ID. You want the output in two columns: the first column would have the LAST_NAME of the managers and the second column would have LAST_NAME of the employees.

Which SQL statement would you execute?

A. SELECT m.last_name "Manager", e.last_name "Employee"
FROM employees m JOIN employees e
ON m.employee_id = e.manager_id
WHERE m.manager_id=100;

B. SELECT m.last_name "Manager", e.last_name "Employee"
FROM employees m JOIN employees e
ON m.employee_id = e.manager_id
WHERE e.managerjd=100;

C. SELECT m.last_name "Manager", e.last_name "Employee"
FROM employees m JOIN employees e
ON e.employee_id = m.manager_id
WHERE m.manager_id=100;

D. SELECT m.last_name "Manager", e.last_name "Employee"
FROM employees m JOIN employees e
WHERE m.employee_id = e.manager_id AND e.managerjd=100;
B
Evaluate the following SELECT statement and view the Exhibit to examine its output:

SELECT constraint_name, constraint_type, search_condition, r_constraint_name, delete_rule,
status FROM user_constraints WHERE table_name = ORDERS

Which two statements are true about the output? (Choose two.)

A. In the second column, indicates a check constraint.

B. The STATUS column indicates whether the table is currently in use.

C. The R_CONSTRAINT_NAME column gives the alternative name for the constraint.

D. The column DELETE_RULE decides the state of the related rows in the child table when the
corresponding row is deleted from the parent table
A,D
Which of the following queries are Inline Views?

Each correct answer represents a complete solution. Choose all that apply

A: SELECT A.ENAME AS EMP_NAME, A.EMPNO AS EMP_ID, A.SAL AS EMP_SAL FROM EMP A
WHERE A.SAL>2000;

B: SELECT A.EMP_NAME, A.EMP_ID, A.EMP_SAL FROM (SELECT E.ENAME AS EMP_NAME, E.EMPNO AS EMP_ID, E.SAL AS EMP_SAL FROM EMP E WHERE E.SAL>2000) A;

C: SELECT A.EMP_NAME, A.EMP_ID, A.EMP_SAL FROM (SELECT E.ENAME AS EMP_NAME, E.EMPNO AS EMP_ID, E.SAL AS EMP_SAL FROM EMP E) A WHERE A.EMP_SAL>2000;

D: SELECT * FROM (SELECT E.ENAME AS EMP_NAME, E.EMPNO AS EMP_ID, E.SAL AS EMP_SAL FROM EMP E WHERE E.SAL>2000);
B: SELECT A.EMP_NAME, A.EMP_ID, A.EMP_SAL
FROM (SELECT E.ENAME AS EMP_NAME, E.EMPNO AS EMP_ID, E.SAL AS EMP_SAL FROM EMP E WHERE E.SAL>2000) A;

C: SELECT A.EMP_NAME, A.EMP_ID, A.EMP_SAL
FROM (SELECT E.ENAME AS EMP_NAME, E.EMPNO AS EMP_ID, E.SAL AS EMP_SAL FROM EMP E) A
WHERE A.EMP_SAL>2000;

D: SELECT * FROM (SELECT E.ENAME AS EMP_NAME, E.EMPNO AS EMP_ID, E.SAL AS EMP_SAL
FROM EMP E WHERE E.SAL>2000);
Pivoting INSERT is a type of Multiple Insert - Correct or Incorrect ?
Incorrect
Andrew works as a Database Administrator for uCertify Inc. The company uses an
Oracle database. Andrew creates an account named Sales that contains important
tables. He wants to lock the Sales account to ensure that no one is able to connect to
the database by using this account. Which of the following statements will Andrew use to accomplish the task?

A: ALTER USER LOCK ACCOUNT Sale;

B: ALTER USER Sales LOCK;

C: ALTER USER Sales ACCOUNT LOCK;

D: ALTER ACCOUNT Sales LOCK;
C: ALTER USER Sales ACCOUNT LOCK;
It enables users to store the query block permanently in the memory and use it to create complex queries - Correct or Incorrect regarding the benefits of using the WITH clause ?
Incorrect
In the PROD Database we have two tables named EMP and DEPT. DEPT has a primary key called DEPTNO that holds the department number. EMP has a foreign key to the DEPT.DEPTNO column.

If you run DESCRIBE EMP on the SQL prompt, what will the Foreign Key column show up in the
NULL? column?

A: The word "NULL"
B: The words "NOT NULL"
C: The word "REFERENCES"
D: Nothing
D: Nothing
Using the WHERE clause before the GROUP BY clause excludes the rows before creating groups - Correct or Incorrect ?
Correct
HAVING clause can be used only in the SELECT statement - Correct or Incorrect ?
Correct
Consider the following INSERT statement:

INSERT INTO enrolled_students
(SELECT student_id, student_name, score FROM waiting_list_students WS
WHERE status='Confirmed' AND Fee='Paid'
AND
(WS.student_id, WS.score)
IN
(SELECT student_id, score FROM scores WHERE score>=200) );

Which of the following statements are TRUE about the given INSERT statement? (Choose all that apply.)

Rows are inserted in the enrolled_students table for those students who have been confirmed, paid the fee, and scored less than 200.

Rows are inserted in the enrolled_students table for those students who have been confirmed, paid the fee, and scored greater than or equal to 200.

Rows are not inserted in the enrolled_students table only for those students who have not been
confirmed, not paid the fee, and scored greater than 200.

Rows are not inserted in the enrolled_students table only for those students who have not been
confirmed, not paid the fee, or scored less than 200.
Rows are inserted in the enrolled_students table for those students who have been confirmed, paid the fee, and scored greater than or equal to 200.

Rows are not inserted in the enrolled_students table only for those students who have not been confirmed, not paid the fee, or scored less than 200.
It produces higher-level subtotals, moving from right to left through the list of grouping columns specified in the GROUP BY clause - Correct or Incorrect reharding ROLLUP operator ?
Correct
If the REGIONS table, which contains 4 rows, is cross joined to the COUNTRIES table, which contains 25 rows, how many rows appear in the final results set?
100 rows
Data dictionary views are those database objects that are dynamic - Correct or Incorrect about VIEWS ?
Incorrect
How many tables can be included in a JOIN?
Two, three, or more
What is the default number of decimal places for the ROUND number function?
Zero
You want to retrieve the last date in the month of January. Which SQL queries will you use to accomplish the task?
SELECT LAST_DAY('01-JAN-2008') FROM DUAL;
COMPOSE()
COMPOSE takes as its argument a string, or an expression that resolves to a string, in any data type, and returns a Unicode string in the same character set as the input.

char can be any of the data types CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or
NCLOB.

CLOB and NCLOB values are supported through implicit conversion. If char is a character LOB value, then it is converted to a VARCHAR value before the COMPOSE operation. The operation will fail if the size of the LOB value exceeds the supported length of the VARCHAR in the particular development environment.
For which column would you create an index?
a column containing a wide range of values
Which object privileges CAN be granted to roles?
INSERT / ALTER / UPDATE
Which of the following system privileges should a user have to create a sequence in another user's schema?
CRATE ANY SEQUENCE
Which special characters is used to retrieve all the columns of a table, without specifying the name of the columns?
*
SQL can create new databases - Correct or Incorrect about SQL ?
Correct
Which conversion functions is used to convert a string to an INTERVAL DAY TO SECOND DataType?
TO_DSINTERVAL
Constraints only enforce rules at the table level - Correct or Incorrect about Constraints ?
Incorrect
It is not possible to specify a check constraint for a view - Correct or Incorrect about CHECK constraints ?
Correct
How can you change the primary key value of a row?
Change it with a simple UPDATE statement
Which of the following data dictionary views does not have an OWNER column?
USER_TABLES
"Exists, In, Union, Like " - Which is a Boolean operator?
EXISTS
If the WHERE clause is not used, the UPDATE statement will not update any rows in the table - Correct or Incorrect about UPDATE statement ?
Incorrect
Examine the structures of the department and asset tables

department
---------------
dept_id NUMBER(9) NOT NULL
dept_abbr VARCHAR2(4)
dept_name VARCHAR2(25) NOT NULL
mgr_id NUMBER

asset
-----------
asset_id NUMBER(9) NOT NULL
asset_value FLOAT
asset_description VARCHAR2(25)
dept_id NUMBER(9)

The dept_id column of the asset table has a FOREIGN KEY constraint referencing the department table.

You attempt to update the asset table using this statement:

UPDATE asset
SET dept_id =
(SELECT dept_id
FROM department WHERE dept_name =
(SELECT dept_name
FROM department WHERE dept_abbr = 'FINC')),
asset_value = 10000 WHERE asset_id = 2;

Which two statements must be true for this UPDATE statement to execute without generating an error? (Choose two.)

An asset with an asset_id value of 2 must exist in the asset table.

Only one row in the department table can have a dept_abbr value of FINC.

One of the subqueries should be removed because subqueries cannot be nested.

Both of the subqueries used in the UPDATE statement must return one and only one non-null value.

Only one row in the department table can have the same dept_name value as the department with
dept_abbr of FINC
Only one row in the department table can have a dept_abbr value of FINC.

Only one row in the department table can have the same dept_name value as the department with dept_abbr of FINC.
View the Exhibit and examine the data in the
PRODUCT INFORMATION table.

Which two tasks would require subqueries? (Choose two.)

A. displaying the minimum list price for each product status

B. displaying all supplier IDs whose average list price is more than 500

C. displaying the number of products whose list prices are more than the average list price

D. displaying all the products whose minimum list prices are more than the average list price of
products having the product status orderable

E. displaying the total number of products supplied by supplier 102071 and having product status OBSOLETE
C,D
You work as a Database Developer for Dolliver Inc. The company uses Oracle as its database.

You designed a database that contains a table named Employee to hold information of all employees. Data in the first_name column is shown below:

z Samantha
z Suzaine
z John
z Jackson
z Joseph

You issue the following statement to retrieve the last_name of that employee whose first_name is John:

SELECT last_name FROM employee
WHERE first_name = 'JOHN';

What will be the result of the query?

A: The query will return the string "JOHN".
B: The query will return the last_name of John.
C: The query will not return any row.
D: Oracle will display an error message.
C: The query will not return any row.
You work as a Database Administrator for Dolliver Inc. The company uses Oracle 10g as its database. You run the following statement at the SQL prompt:

SELECT oldest_flashback_scn FROM V$FLASHBACK_DATABASE_LOG;

Which of the following outputs will you receive as a result of the SQL statement?

A: A list of flashback operations performed that have used oldest time.

B: An approximate time to which a database can be flashed back.

C: An approximate system change number (SCN) to which a database can be flashed back.

D: A list of flashback operations performed that have used oldest SCN.
C: An approximate system change number (SCN) to which a database can be flashed back
If the query block name and the table name were the same, the table name would take precedence - Correct or Incorrect regardingt the WITH clause ?
Incorrect
You maintain the data about the various sales_persons and orders in the sales_persons and orders tables. You need to display the records of the products sold by a sales person named Victor.

Which of the following queries should you use to achieve the desired results?

SELECT order_id, order_date, price, quantity FROM orders
WHERE (order_id) IN
(SELECT order_id FROM sales_persons);

SELECT order_id, order_date, price, quantity FROM orders
WHERE (order_id) NOT IN
(SELECT order_id FROM sales_persons);

SELECT order_id, order_date, price, quantity FROM orders
WHERE (order_id) NOT IN
(SELECT order_id FROM sales_persons WHERE sales_person_name="Victor");

SELECT order_id, order_date, price, quantity FROM orders
WHERE (order_id) IN
(SELECT order_id FROM sales_persons WHERE sales_person_name="Victor");
SELECT order_id, order_date, price, quantity FROM orders
WHERE (order_id) IN
(SELECT order_id FROM sales_persons WHERE sales_person_name="Victor");
Group functions only operate on a single row at a time - Correct or Incorrect ?
Incorrect
Column aliases cannot be used in the GROUP BY clause - Correct or Incorrect ?
Correct
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. You used the ROUND function with DATE value as its argument.

The syntax that you used is given below:

SELECT ROUND (to_date ('10-AUG-04'), 'YEAR') FROM DUAL;

What will be the result of the SQL statement?

A: 10-AUG-04
B: 01-JAN-05
C: 10-AUG-03
D: 01-SEP-04
B: 01-JAN-05
Which features is used to retrieve metadata and historical data for a given transaction in a given time interval?
Flashback Transaction Query
In which of the following places is it possible for the same column to have different datatypes when data is moved into or out of an external table?

Each correct answer represents a complete solution. Choose all that apply.

A: Datafile
B: Table
C: External table
D: Database
A: Datafile
C: External table
D: Database
The (+) operator can appear only in the WHERE clause and can be applied only to a column of a table or view - Correct or Incorrect about using Oracle Join Operator ( + ) ?
Correct
Which data dictionary view would you query to display the SELECT privileges granted on columns of tables that you own?
USER_COL_PRIVS_MADE
The account table contains these columns:

account_id NUMBER(12)
finance_charge NUMBER(7,2)
prev_balance NUMBER(7,2)
payments NUMBER(7,2)
new_purchases NUMBER(7,2)

You created the account_id_seq sequence to generate sequential values for the account_id column.

You issue this statement:

ALTER TABLE account
MODIFY (finance_charge NUMBER(8,2));

Which statement about the account_id_seq sequence is true?

The sequence is dropped.
The sequence is unchanged.
The precision of the sequence is changed.
The sequence is reverted to its minimum value
The sequence is unchanged
Which join types when used in a query is used to retrieve all the rows from all the tables specified in the query?
FULL OUTER JOIN
A subquery must be put in the right hand of the comparison operator - True or False ?
1
They help in creating a hierarchical relationship between rows in a table - Correct or Incorrect about Hierarchial Queries ?
Incorrect
Which conversion functions is used to convert a string in any data type to a Unicode string?
COMPOSE
Creating a sequence causes sequence numbers to be stored in a table - Correct or Incorrect about a Sequence ?
Incorrect
Which character function is functionally equivalent to using the || operator?
CONCAT. The syntax of the CONCAT function is CONCAT(column1|expression1, column2|expression2)
Which privileges should be granted to a user so that he/she may compile the function or procedure?
Execute
Which clauses is used to specify a top-level (root) object view?
WITH OBJECT IDENTIFIER
You want to grant certain privileges to a database user named Fredrick so that he can create a view in his own schema. Which privileges can help him to accomplish the task?
CREATE VIEW
Which of the following clauses will you use to specify a criterion for row retrieval?
WHERE
Which conversion functions is used to convert string to the national character set?
UNISTR
You grant the CREATE VIEW privilege to a database user named John. Which of the following operations is John able to perform?
Create a view in his own schema
The size of a table does not need to be specified - True or False ?
1
User JOHN updates some rows but does not commit the changes. User ROOPESH queries the rows that JOHN updated. Which statements is true?
ROOPESH will see the old versions of the rows
You can add your own comments to the data dictionary with the COMMENT statement using which of the following?
COLUMN / TABLE
Which set operator returns only results that are common to two queries?
INTERSECT
Which privileges allows you to update values in any table or in the base table of any view?
UPDATE ANY TABLE
Which views provides an information about the status of the flash recovery area?
DBA_OUTSTANDING_ALERTS
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. You want to retrieve the last date in the month of January.

Which of the following SQL queries will you use to accomplish the task?

A: SELECT LAST_DAY('JAN') FROM DUAL;

B: SELECT LAST_DATE('JANUARY');

C: SELECT LAST_DATE('JAN') FROM DUAL;

D: SELECT LAST_DAY('01-JAN-2008')
FROM DUAL;
D: SELECT LAST_DAY('01-JAN-2008') FROM DUAL;
View the Exhibit and examine the details of the EMPLOYEES table.

Evaluate the following SQL statements:

Statement 1:

SELECT employee_id, last_name, job_id, manager_id FROM employees START WITH
employee_id = 101
CONNECT BY PRIOR employee_id = manager_id AND manager_id != 108;

Statement 2:

SELECT employee_id, last_name, job_id, manager_id
FROM employees
WHERE manager_id != 108
START WITH employee_id = 101
CONNECT BY PRIOR employee_id = manager_id;

Which two statements are true regarding the above SQL statements? (Choose two.)

A. Statement 2 would not execute because the WHERE clause condition is not allowed in a
statement that has the START WITH clause.

B. The output for statement 1 would display the employee with MANAGERJD 108 and all the
employees below him or her in the hierarchy.

C. The output of statement 1 would neither display the employee with MANAGERJD 108 nor any
employee below him or her in the hierarchy.

D. The output for statement 2 would not display the employee with MANAGERJD 108 but it would
display all the employees below him or her in the hierarchy
C,D
Examine the structures of the player and team tables:

player
-------------
player_id NUMBER(9) PK
last_name VARCHAR2(25)
first_name VARCHAR2(25)
team_id NUMBER
manager_id NUMBER(9)

team
----------
team_ID NUMBER PK
team_name VARCHAR2(30)

For this example, team managers are also players, and the manager_id column references the player_id column. For players who are managers, manager_id is NULL.

Which SELECT statement will provide a list of all players, including the player's name, the team name, and the player's manager's name?

SELECT p.last_name, p.first_name, p.manager_id, t.team_name FROM player p NATURAL JOIN team t;

SELECT p.last_name, p.first_name, p.manager_id, t.team_name FROM player p JOIN team t USING (team_id);

SELECT p.last_name, p.first_name, m.last_name, m.first_name, t.team_name FROM player p
LEFT OUTER JOIN player m ON (p.manager_id = m.player_id) LEFT OUTER JOIN team t ON (p.team_id = t.team_id);

SELECT p.last_name, p.first_name, m.last_name, m.first_name, t.team_name FROM player p JOIN player m ON (p.manager_id = m.player_id)
RIGHT OUTER JOIN team t ON (p.team_id = t.team_id);

SELECT p.last_name, p.first_name, m.last_name, m.first_name, t.team_name FROM player p
LEFT OUTER JOIN player m ON (p.player_id = m.player_id) LEFT OUTER JOIN team t ON (p.team_id = t.team_id);
SELECT p.last_name, p.first_name, m.last_name, m.first_name, t.team_name FROM player p
LEFT OUTER JOIN player m ON (p.manager_id = m.player_id) LEFT OUTER JOIN team t ON (p.team_id = t.team_id);
View the Exhibit and examine the description of the ORDERS table.

Your manager asked you to get the SALES_REP_ID and the total numbers of orders placed by each of the sales representatives.

Which statement would provide the desired result?

A. SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders GROUP BY sales_rep_id;

B. SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders GROUP BY sales_rep_id, total_orders;

C. SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders;

D. SELECT sales_rep_id, COUNT(order_id) total_orders FROM orders WHERE sales_rep_id IS NOT NULL;
A
It is possible to use column alias in the GROUP BY clause - Correct or Incorrect ?
Incorrect
Having Clause must occur after the WHERE clause - Correct or Incorrect ?
Correct
Evaluate this SQL statement:

SELECT id "Event", SUM(reg_amt) "Registration Amt" FROM event WHERE reg_amt > 1000.00
GROUP BY "Event" ORDER BY 2;

Which clause will cause an error?

SELECT id "Event", SUM(reg_amt) "Registration Amt"

FROM event

WHERE reg_amt > 1000.00

GROUP BY "Event"

ORDER BY 2;
GROUP BY "Event"
What command will insert rows into a table if they don't already exist and will update rows in that same table if they do already exist?
MERGE
Which of the following options will return the same result as the SQL statement given below?

SELECT TO_CHAR (SYSDATE, 'YYYY') FROM DUAL;

A: SELECT EXTRACT (Y FROM SYSDATE) FROM DUAL;

B: SELECT EXTRACT (YEAR FROM SYSDATE) FROM DUAL;

C: SELECT EXTRACT (YYYY FROM SYSDATE) FROM DUAL;

D: SELECT EXTRACT (YY FROM SYSDATE) FROM DUAL;
B: SELECT EXTRACT (YEAR FROM SYSDATE) FROM DUAL;
How many values should a sub query return to be called a scalar sub-query?
One row and one column
Which information can you find in the data dictionary views?
Database object definitions / Privilege information / User information / Constraint and Index information
You maintain two tables, customer and prospect, which have identical structures but different data. You want to synchronize these two tables by inserting records from the prospect table into the customer table, if they do not exist. If the customer already exists in the customer table, you want to update customer data.

Which DML statement should you use to perform this task?

SYNC
MERGE
INSERT
UPDATE
You cannot perform this task with one DML operation
MERGE
When using Oracle proprietary join syntax which clause of the SELECT statement represents the join criteria?
the WHERE clause
Which options is a list of SELECT statement clauses in the proper order in which they can appear in a syntactically correct SELECT statement?
SELECT, FROM, WHERE, CONNECT BY, START WITH
Which type of queries ask for the n largest or smallest values of a given column?
Top-n queries
Which types of functions accepts numeric input values and return numeric output values?
Number functions
To define a table to be operated on by a containing query - True or False regarding the Use of Subquery ?
1
Which statements correctly differentiates a system privilege from an object privilege?
A system privilege is the right to perform specific activities in a database, whereas an object privilege is a right to perform activities on a specific object in the database.
The usernames of all the users including the database administrators are stored in the data dictionary - True or False regarding Data Dictionary Views ?
1
Synonyms are used to reference only those tables that are owned by another user - Correct or Incorrect about SYNONYMS ?
Incorrect
By default, only the user who created a table may see the rows. To allow other users to see rows, the user must grant access privileges - Correct or Incorrect about Privileges ?
Correct
An index:
May improve the performance of an UPDATE statement that uses a WHERE clause, if the WHERE clause performs an equality comparison on an indexed column in a table
The result of executing the following SQL statement? SELECT TRUNC(SYSDATE,'YEAR') FROM DUAL; Assume that the value of SYSDATE is equal to 30-DEC-2008.
1-Jan-08
Which characters will you use as a substitution variable ?
&&, &
Which data types is valid to define a variable by using the ACCEPT command?
CHAR
Which subqueries is used for row by row processing?
Correlated subquery
One place to get a master list of all the views that form the data dictionary:
DICTIONARY
Which of the following set operations returns only those rows that are returned by each of the two SELECT statements?
INTERSECT
Which clauses is used to return the rows affected by the DELETE statement?
RETURNING clause
Which is needed in order to create an index on a user-written function?
DETERMINISTIC
It removes all the rows as well as the structure of the table - - Correct or Incorrect about DELETE FROM statements ?
Incorrect
The details of the order ID, order date, order total, and customer ID are obtained from the ORDERS table. If the order value is more than 60000, the details have to be added to the LARGE_ORDERS table. The order ID, order date, and order total should be added to the ORDER_HISTORY table, and order ID and customer ID should be added to the CUST_HISTORY table. Which multi-table INSERT statement would you use to accomplish the task?

A: Conditional First INSERT
B: Conditional ALL INSERT
C: Unconditional INSERT
D: Pivoting INSERT
B: Conditional ALL INSERT
View the Exhibit and examine the structure of the ORDERS table.

You have to display ORDER_ID, ORDER_DATE, and CUSTOMER_ID for all those orders that
were placed after the last order placed by the customer whose CUSTOMER_ID is 101

Which query would give you the desired output?

A. SELECT order_id, order_date FROM orders
WHERE order_date > ALL (SELECT MAX(order_date) FROM orders) AND
Customer_id = 101;

B. SELECT order_id, order_date FROM orders
WHERE order_date > ANY (SELECT order_date
FROM orders WHERE customer_id = 101);

C. SELECT order_id, order_date FROM orders
WHERE order_date > ALL (SELECT order_date
FROM orders WHERE customer_id = 101);

D. SELECT order_id, order_date FROM orders
WHERE order_date IN (SELECT order_date
FROM orders WHERE customer id = 101);
C
Evaluate the following SQL statement:

SELECT Address
FROM LOCATIONS
WHERE
REGEXP_INSTR (Address, '[^[:alpha:]]') = 1;

Which statement is true regarding the output of the above SQL statement?

A: It would display all the addresses that do not have a substring 'alpha'.

B: It would display all the addresses which have the ^ sign as their first character.

C: It would display all the addresses where the first character is a special character

D: It would display all the addresses where the first character is not a letter of the alphabet.
D: It would display all the addresses where the first character is not a letter of the alphabet.
Which of the following types of index would you use to avoid large sorting operations,
such as a SQL query that requires 10,000 rows to be presented in sorted order?

A: Key-compressed index
B: Unique index
C: Default index
D: B-tree indexes
B-tree indexes
Which group functions can return character and date results?
MIN
Which of the following statements is NOT true about an unused column?

A: Marking a column as unused and then using the alter table name drop unused column statement is useful because it allows the DBA to take away column access quickly and immediately.

B: Information about the unused column does not appear in the output of the describe table command.

C: An unused column can be seen by the users of the table.

D: Users can query the dictionary view DBA_UNUSED_COL_TABS to see a list of all
tables that have unused columns.
C: An unused column can be seen by the users of the table.
Which is used to set the internal Oracle Database clock to a time in the past so that you can examine data that was current at that time?
DBMS_FLASHBACK Package
Which SQL statement would display the view names and definitions of all the views owned by you?

A. SELECTviewjiame, text
FROM user_view;

B. SELECTviewjiame, text
FROM user_object;

C. SELECTviewjiame, text
FROM user_objects;

D. SELECTview_name, text
FROM user views;
D
A scalar subquery expression is a subquery that returns exactly one column - Correct or Incorrect about Scaler subquery ?
Incorrect
Evaluate the command issued by the DBA:

z Statement 1: CREATE ROLE emp,
z Statement 2: GRANT CREATE TABLE, SELECT ON oe.orders TO emp,
z Statement 3: GRANT emp, create table TO SCOTT;

Here, SCOTT is a user in the database.

Which statement is true regarding the execution
of the above commands?

A: All three statements would execute successfully.

B: Statement 2 would not execute because system privileges and object privileges
cannot be granted together in a single GRANT statement.

C: Statement 3 would not execute because role and system privileges cannot be granted together in a single GRANT statement.

D: Statement 1 would not execute because the WITH GRANT option is missing.
B: Statement 2 would not execute because system privileges and object privileges cannot be granted together in a single GRANT statement
Which meta characters matches the pattern at the beginning of the string?
^
How many rows are selected if a Cartesian product is performed between the two tables that contain 6 and 5 rows, respectively?
30
Which functions can list, for a given node, the complete hierarchical path to that node from the root node?
SYS_CONNECT_BY_PATH
You work as a Database Designer for Bell Ceramics Inc. The company uses Oracle 11g
as its database. The database contains a table named Employee. You issue the DESC
[RIBE] command on the Employee table and get the following result:

Emp_id NOT NULL NUMBER<6>
Emp_name NOT NULL VARCHAR2<20>
Emp_salary NOT NULL NUMBER<8,2>
Emp_add NOT NULL VARCHAR2<25>

You analyze the data returned by the DESC[RIBE] command.

Which of the following data is valid for the Emp_salary column?

A: 9999999
B: US$ 99999.99
C: 999,999.99 US$
D: 999999.99
D: 999999.99
If you are not the DBA, which privilege must you have to create a public synonym on another user's table?
the CREATE PUBLIC SYNONYM privilege
You have used the TO_CHAR function to display a date field with the day, month and year spelt out. Which format model will you use to truncate leading and trailing blank spaces in the output?
FM
When using the TO_CHAR function to format dates, which format model element will display the three-letter abbreviation for the day of the week?
DY
Which clauses used in the SELECT statement is supported in a view definition subquery?
WITH, ORDER BY, GROUP BY
What should you do to modify a view?
Use the OR REPLACE clause and replace the existing view. / Drop the view and create another one.
Single-Row Functions must have at least one mandatory parameter - True or False ?
1
According to the principle of least privilege, which roles should be granted to only the accounts that need the privilege?
SYSDBA / SYSOPER / SYSASM
Which statements about a function-based index is true?
It performs only an index scan
Which commands is used to create an Oracle role?
Create role
You can modify the structure of a NOT NULL constraint using the ALTER TABLE statement - Correct or Incorrect about NOT NULL constraints ?
Incorrect
Which techniques is used to reverse the effect of the DROP TABLE command?
Flashback drop
Which operators is used to check the existence of a row or value in the result set of the inner subquery?
EXISTS
Reversing the order of the SELECT statements when using the INTERSECT operator has what effect on the results ?
It will not affect the results.
The value for a CHAR data type column is blank-padded to the maximum defined column width - True or False about Oracle Data Types ?
1
A co-related sub query can be used in UPDATE statements to update data from other tables - Correct or Incorrect about UPDATE statement ?
Correct
Which is NOT a benefit if an index is created by specifying NOLOGGING option in the CREATE INDEX statement?
Table on which the index is created will be automatically backed up
If the WHERE clause is not used, the UPDATE statement will not update any rows in the table - Correct or Incorrect about UPDATE statements ?
Incorrect
It will return an error if the undo retention time is less than the lower bound time or SCN specified - Correct or Incorrect about FLASHBACK Version Query?
Incorrect
You work as an Assistant Database Administrator for Gadgets Inc. You have mistakenly dropped an important database schema named ORDER of the production department on Nov 19, 2007 at 9:00 AM. The database is used to take orders and process the count of orders. A senior DBA notices an error in the database within 5 minutes.

Which of the following actions will you take to overcome the issue?

A: Perform a cancel-based incomplete recovery for the database.

B: Perform a rollback of all the committed change for the database.

C: Flashback the database using SQL*Plus statements.

D: Perform an incomplete recovery for the database.
C: Flashback the database using SQL*Plus statements.
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its database. You have created a sequence named Dept_seq that is used in the Department_id column of the Department table. The starting value of the sequence is 120 and it also does not allow caching and cycle. You want to verify the other sequence values.

Which of the following data dictionary views will you use to accomplish the task?

A: USER_OBJECTS
B: USER_SYNONYMS
C: USER_SEQUENCES
D: USER_SOURCE
C: USER_SEQUENCES
View the Exhibit and examine the structure of the EMPLOYEES table.

You want to know the FIRST_NAME and SALARY for all employees who have the same manager
as that of the employee with the first name 'Neena' and have salary equal to or greater than that of'Neena'.

Which SQL statement would give you the desired result?

A. SELECTfirst_name, salary
FROM employees
WHERE (manager_id, salary) >= ALL (SELECT manager_id, salary FROM employees WHERE
first_name = 'Neena') AND first_name <> 'Neena';

B. SELECTfirst_name, salary
FROM employees
WHERE (manager_id, salary) >= (SELECT manager_id, salary
FROM employees
WHERE first_name = 'Neena')
AND first_name <> 'Neena';

C. SELECT first_name, salary
FROM employees
WHERE (manager_id, salary) >= ANY (SELECT manager_id, salary FROM employees WHERE
first_name = 'Neena' AND first_name <> 'Neena';

D. SELECT first_name, salary FROM employees
WHERE (manager_id = (SELECT manager_id
FROM employees
WHERE first_name = 'Neena')
AND salary >= (SELECT salary
FROM employees
WHERE first_name = 'Neena'))
AND first name <> 'Neena';
D
Which of the following values is returned after the following SQL statement is executed?

SELECT ADD_MONTHS(SYSDATE,-1) FROM DUAL:

Assume the value of SYSDATE to be 31-JUL-2008 12:05pm.

A: 30-JUL-2008 12:05pm
B: 30-JUN-2008 12:05pm
C: 01-AUG-2008 12:05pm
D: 31-JUL-2008 12:05pm
30-JUN-2008 12:05pm
Meta Character Matches the pattern at the beginning of the string --
^a
View the Exhibit and examine the structure of ORD and ORD_ITEMS tables.

In the ORD table, the PRIMARY KEY is ORD_NO and in the ORD_ITEMS tables the composite
PRIMARY KEY is (ORD_NO, ITEM_NO).

Which two CREATE INDEX statements are valid? (Choose two.)

A. CREATE INDEX ord_idx
ON ord(ord_no);

B. CREATE INDEX ord_idx
ON ord_items(ord_no);

C. CREATE INDEX ord_idx
ON ord_items(item_no);

D. CREATE INDEX ord_idx
ON ord,ord_items(ord_no, ord_date,qty);
B,C
It is used to test whether the values retrieved by the inner query exist in the result of the outer query - Correct or Incorrect regarding EXIST operator ?
Incorrect
View the Exhibit and examine PRODUCTS and ORDER_ITEMS tables.

You executed the following query to display PRODUCT_NAME and the number of times the
product has been ordered:

SELECT p.product_name, i.item_cnt
FROM (SELECT product_id, COUNT (*) item_cnt
FROM order_items
GROUP BY product_id) i RIGHT OUTER JOIN products p ON i.product_id = p.product_id;

What would happen when the above statement is executed?

A. The statement would execute successfully to produce the required output.

B. The statement would not execute because inline views and outer joins cannot be used together.

C. The statement would not execute because the ITEM_CNT alias cannot be displayed in the
outer query.

D. The statement would not execute because the GROUP BY clause cannot be used in the inline
view.
A
Tasks performed using regular expression support in Oracle Database?
string manipulation and search operations / find and replace operations for a column or expression having string data / format the output for a column or expression having string data.
Which logical condition operator, used in a WHERE clause, returns TRUE only when both of the conditions are true?
AND
What is the effect of using the GROUP BY and ROLLUP keywords in the statement GROUP BY expr1, ROLLUP (expr2, expr3)?
The subtotals calculated will be all the various combinations of expr2 and expr3 while expr1 stays fixed
You work as a Database Administrator for Dolliver Inc. The company uses Oracle as its
database. The manager of the company has asked you to produce a hierarchical report
that displays employee_id, manager_id, the LEVEL pseudo column and employee last
name. For every row in the employees table, you should print a tree structure showing
the employee_id, the employee's manager_id, the manager's manager_id, and so on. He
also instructed you to use indentations for the NAME column.

Which of the following queries will you use to accomplish the task?

A: COLUMN name FORMAT A25
SELECT employee_id, manager_id, LEVEL,
LPAD(last_name, LENGTH(last_name) + (LEVEL*2)-2, '_')
CONNECT BY employee_id = PRIOR manager_id;
COLUMN name CLEAR

B: SELECT employee_id, manager_id, LEVEL,
LPAD(last_name, LENGTH(last_name) + (LEVEL*2)-2, '_')
FROM employees
CONNECT BY employee_id = PRIOR manager_id;
COLUMN name CLEAR

C: COLUMN name FORMAT A25
SELECT employee_id, manager_id, LEVEL,
LPAD(last_name, LENGTH(last_name) + (LEVEL*2)-2, '_')
FROM employees
CONNECT BY employee_id = PRIOR manager_id;
COLUMN name CLEAR

D: COLUMN name FORMAT A25
SELECT employee_id, manager_id, LEVEL,
LPAD(last_name, LENGTH(last_name) + (LEVEL*2)-2, '_')
FROM employees
CONNECT BY employee_id = PRIOR manager_id;
C: COLUMN name FORMAT A25
SELECT employee_id, manager_id, LEVEL,
LPAD(last_name, LENGTH(last_name) + (LEVEL*2)-2, '_')
FROM employees
CONNECT BY employee_id = PRIOR manager_id;
COLUMN name CLEAR
When modifying a sequence, which sequence numbers are affected?
only future sequence numbers
You maintain the database for a retail shop that is offering 25% discounts on FMCG products. To store data about the discount in the database, you execute the following statement:

UPDATE products
SET price=price*0.25
WHERE producttype='FMCG';
COMMIT;

Thirty minutes later, you realize that you have stored the wrong discounted prices. To revert back, you execute the following statements:

FLASHBACK TABLE products
TO TIMESTAMP (SYSTIMESTAMP - INTERVAL '32' MINUTE);

The system responds with the message "Flashback complete."

UPDATE products
SET price=price*0.75
WHERE producttype='FMCG';
COMMIT;

Later, the manager of the shop decides to offer a discount of 50%, instead of 25%, on the original price. You execute the following statement:

ROLLBACK;

UPDATE products
SET price=price*0.50
WHERE producttype='FMCG';
COMMIT;

For the purpose of this scenario, assume that row movement has been enabled on the products table. Which of the following statements is correct?

The final value of the price column is 12.5% of the original value for price.

The final value of the price column is 25% of the original value for price.

The final value of the price column is 37.5% of the original value for price.

The final value of the price column is 50% of the original value for price
The final value of the price column is 37.5% of the original value for price
If you want to calculate the number of days between two given dates, which date function should you use?
MONTHS_BETWEEN
The CUBE operation used with the SUM function often results in:
More rows than ROLLUP / A grand total
When using the TO_CHAR function to format dates, what does MON in a format model display?
the three-letter month abbreviation using three capital letters
Which operators is used to test if a subquery returns rows?
EXISTS
Assuming SYSDATE=07-JUN-1996 12:05pm, what value is returned after executing the following statement? SELECT ADD_MONTHS(SYSDATE,-1) FROM DUAL;
07-MAY-1996 12:05pm
DROP ROLE Sales; When he executes the statement, it returns an error. What is the most likely cause of the issue?
David is not granted the role with the ADMIN OPTION / David does not have the DROP ANY ROLE system privilege
Which of the following SQL statements can be executed on any VIEW object?
SELECT
Which SQL statements will authorize the user account JESSE to create tables in each and every user account in the database?
GRANT CREATE ANY TABLE TO JESSE
Which indexed allows creation of indexes on expressions, internal functions, and user-written functions in PL/SQL and Java?
Function-based index
Synonym - Is it a Database Object ? - Yes or No
yes
MONTHS_BETWEEN()
MONTHS_BETWEEN returns number of months between dates date1 and date2. The month and the last day of the month are defined by the parameter NLS_CALENDAR. If date1 is later than date2, then the result is positive. If date1 is earlier than date2, then the result is negative. If date1 and date2 are either the same days of the month
or both last days of months, then the result is always an integer. Otherwise Oracle Database calculates the fractional portion of the result based on a 31-day month and considers the difference in time components date1 and date2.

The following example calculates the months between two dates:

SELECT MONTHS_BETWEEN
(TO_DATE('02-02-1995','MM-DD-YYYY'),
TO_DATE('01-01-1995','MM-DD-YYYY') ) "Months"
FROM DUAL;

Months
----------
1.03225806
Which is the value of the scalar subquery expression if the subquery returns 0 rows?
NULL
When creating a table, column definitions can be omitted if what is used?
the AS subquery clause (CTAS, CREATE TABLE AS SELECT)
If a user wants to create an external table, he must have the required read and write operating system privileges on the appropriate operating system directories - True or False ?
1
In which cases is DROP COLUMN not allowed?
If sqlAuthorization is true
The SET clause is used to update multiple columns of a table separated by commas - Correct or Incorrect about UPDATE statement ?
Correct
For each DML operation performed, the corresponding indexes are automatically updated - Correct or Incorrect about INDEXES ?
Correct
The data it identifies remains unchanged after the MERGE statement executes -- Correct or Incorrect about the USING clause of MERGE statement ?
Correct
Which SET operator would you use in the blank space in the following SQL statement to list the departments where all the employees have managers?

SELECT department_id
FROM departments
----------------------------
SELECT department_id
FROM employees
WHERE manager_id IS NULL;

A. UNION
B. MINUS
C. INTERSECT
D. UNION ALL
B
Which set operators will sort the rows?
INTERSECT, MINUS, UNION
Examine the structures of the product and shipping_cost tables:

product
-----------------
product_id NUMBER(9)
product_name VARCHAR2(20)
cost NUMBER(5,2)
retail_price NUMBER(5,2)
weight NUMBER(5,2)

shipping_cost
----------------------------
id NUMBER(9)
lowweight NUMBER(5,2)
highweight NUMBER(5,2)
cost NUMBER(5,2)

You need to display each product name, including the shipping cost of each product. The shipping cost is calculated by comparing the weight of a product to the lower and upper weight values in the shipping_cost table.

Which two SELECT statements could you use? (Choose two.)

SELECT product_name, cost
FROM product NATURAL JOIN shipping_cost;

SELECT p.product_name, s.cost
FROM product p, shipping_cost s
WHERE p.product_id = s.id(+);

SELECT p.product_name, s.cost
FROM product p, shipping_cost s
WHERE p.weight BETWEEN s.lowweight AND s.highweight;

SELECT p.product_name, s.cost
FROM product p JOIN shipping_cost s
ON (p.weight BETWEEN s.lowweight AND s.highweight);

SELECT p.product_name, s.cost
FROM product p, shipping_cost s
WHERE p.weight >= s.highweight;
SELECT p.product_name, s.cost
FROM product p, shipping_cost s
WHERE p.weight BETWEEN s.lowweight AND s.highweight;

SELECT p.product_name, s.cost
FROM product p JOIN shipping_cost s
ON (p.weight BETWEEN s.lowweight AND s.highweight);
You need to display the Sales_Id of the sales that has the highest total value among all the sales in the Sales table. Which query would produce the desired output?

A: SELECT Sales_id FROM Sales
GROUP BY Sales_id HAVING SUM (Unit_Price * Quantity) = (SELECT MAX (SUM (Unit_Price * Quantity)) FROM Sales GROUP BY Sales_id);

B: SELECT Sales_Id FROM Sales
WHERE (Unit_Price * Quantity)=(SELECT MAX(Unit_Price * Quantity) FROM Sales)
GROUP BY Sales_Id;

C: SELECT Sales_id FROM Sales
WHERE (Unit_Price * Quantity) = (SELECT MAX(Unit_Price * quantity) FROM Sales
GROUP BY Sales_id);

D: SELECT Sales_Id FROM Sales
WHERE (Unit_Price * Quantity)= MAX(Unit_Price * Quantity) GROUP BY Sales_Id;
A: SELECT Sales_id FROM Sales
GROUP BY Sales_id HAVING SUM (Unit_Price * Quantity) = (SELECT MAX (SUM (Unit_Price * Quantity))
FROM Sales GROUP BY Sales_id);