Q1. - (Topic 2)
Evaluate the following SQL statement:
SQL> SELECT cust_id, cust_last_name FROM customers WHERE cust_credit_limit IN (select cust_credit_limit FROM customers WHERE cust_city ='Singapore');
Which statement is true regarding the above query if one of the values generated by the subquery is NULL?
A. It produces an error.
B. It executes but returns no rows.
C. It generates output for NULL as well as the other values produced by the subquery.
D. It ignores the NULL value and generates output for the other values produced by the subquery.
Answer: C
Q2. - (Topic 2)
The STUDENT_GRADES table has these columns:
STUDENT_ID NUMBER(12)
SEMESTER_END DATE
GPA NUMBER(4,3)
The registrar requested a report listing the students' grade point averages (GPA) sorted from highest grade point average to lowest.
Which statement produces a report that displays the student ID and GPA in the sorted order requested by the registrar?
A. SELECT student_id, gpa FROM student_grades ORDER BY gpa ASC;
B. SELECT student_id, gpa FROM student_grades SORT ORDER BY gpa ASC;
C. SELECT student_id, gpa FROM student_grades SORT ORDER BY gpa;
D. SELECT student_id, gpa FROM student_grades ORDER BY gpa;
E. SELECT student_id, gpa FROM student_grades SORT ORDER BY gpa DESC;
F. SELECT student_id, gpa FROM student_grades ORDER BY gpa DESC;
Answer: F
Explanation:
sorted by highest to lowest is DESCENDING order
Incorrect Answer: Aresult in ascending order Bwrong syntax with SORT keyword Cwrong syntax with SORT keyword Ddefault value for ORDER by is in ascending order Ewrong syntax with SORT keyword
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 2-22
Q3. - (Topic 2)
You issue the following query:
SQL> SELECT AVG(MAX(qty))
FROM ord_items
GROUP BY item_no
HAVING AVG(MAX(qty))>50;
Which statement is true regarding the outcome of this query?
A. It executes successfully and gives the correct output.
B. It gives an error because the HAVING clause is not valid.
C. It executes successfully but does not give the correct output.
D. It gives an error because the GROUP BY expression is not valid.
Answer: B
Explanation:
The general form of the SELECT statement is further enhanced by the addition of the
HAVING clause and becomes:
SELECT column|expression|group_function(column|expression [alias]),…}
FROM table
[WHERE condition(s)]
[GROUP BY {col(s)|expr}]
[HAVING group_condition(s)]
[ORDER BY {col(s)|expr|numeric_pos} [ASC|DESC] [NULLS FIRST|LAST]];
An important difference between the HAVING clause and the other SELECT statement
clauses is that it may only be specified if a GROUP BY clause is present. This dependency
is sensible since group-level rows must exist before they can be restricted. The HAVING
clause can occur before the GROUP BY clause in the SELECT statement. However, it is
more common to place the HAVING clause after the GROUP BY clause. All grouping is
performed and group functions are executed prior to evaluating the HAVING clause.
Q4. - (Topic 1)
Examine the statement:
Create synonym emp for hr.employees;
What happens when you issue the statement?
A. An error is generated.
B. You will have two identical tables in the HR schema with different names.
C. You create a table called employees in the HR schema based on you EMP table.
D. You create an alternative name for the employees table in the HR schema in your own schema.
Answer: D
Q5. - (Topic 2)
Which two statements are true regarding the DELETE and TRUNCATE commands? (Choose two.)
A. DELETE can be used to remove only rows from only one table at a time.
B. DELETE can be used to remove only rows from multiple tables at a time.
C. DELETE can be used only on a table that is a parent of a referential integrity constraint.
D. DELETE can be used to remove data from specific columns as well as complete rows.
E. DELETE and TRUNCATE can be used on a table that is a parent of a referential integrity constraint having ON DELETE rule.
Answer: A,E
Explanation:
Transactions, consisting of INSERT, UPDATE, and DELETE (or even MERGE) commands can be made permanent (with a COMMIT) or reversed (with a ROLLBACK). A TRUNCATE command, like any other DDL command, is immediately permanent: it can never be reversed. The Transaction Control Statements A transaction begins implicitly with the first DML statement. There is no command to explicitly start a transaction. The transaction continues through all subsequent DML statements issued by the session. These statements can be against any number of tables: a transaction is not restricted to one table. It terminates (barring any of the events listed in the previous section) when the session issues a COMMIT or ROLLBACK command. The SAVEPOINT command can be used to set markers that will stage the action of a ROLLBACK, but the same transaction remains in progress irrespective of the use of SAVEPOINT Explicit Transaction Control Statements You can control the logic of transactions by using the COMMIT, SAVEPOINT, and ROLLBACK statements. Note: You cannot COMMIT to a SAVEPOINT. SAVEPOINT is not ANSI-standard SQL.
untitled
Q6. - (Topic 2)
Examine the statement:
GRANT select, insert, update
ON student_grades
TO manager
WITH GRANT OPTION;
Which two are true? (Choose two.)
A. MANAGER must be a role.
B. It allows the MANAGER to pass the specified privileges on to other users.
C. It allows the MANAGER to create tables that refer to the STUDENT_GRADES table.
D. It allows the MANAGER to apply all DML statements on the STUDENT_GRADES table.
E. It allows the MANAGER the ability to select from, insert into, and update the STUDENT_GRADES table.
F. It allows the MANAGER the ability to select from, delete from, and update the STUDENT_GRADES table.
Answer: B,E
Explanation:
GRANT ROLE to ROLE/USER
Incorrect Answer: ARole can be grant to user CCreate table privilege is not granted DExecute privilege is not granted FDelete privilege is not granted
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 13-15
Q7. - (Topic 2)
Which describes the default behavior when you create a table?
A. The table is accessible to all users.
B. Tables are created in the public schema.
C. Tables are created in your schema.
D. Tables are created in the DBA schema.
E. You must specify the schema when the table is created.
Answer: C
Explanation:
sorted by highest to lowest is DESCENDING order
Incorrect Answer: Agrant the table privilege to PUBLIC Blogin as sysoper Dlogin as DBA or sysdba Eno such option is allow.
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 9-9
Q8. - (Topic 1)
View the Exhibit and examine the structure of the PROMOTIONS table. Evaluate the following SQL statement:
The above query generates an error on execution.
Which clause in the above SQL statement causes the error?
A. WHERE
B. SELECT
C. GROUP BY
D. ORDER BY
Answer: C
Q9. - (Topic 1)
The STUDENT_GRADES table has these columns:
Which statement finds students who have a grade point average (GPA) greater than 3.0 for the calendar year 2001?
A. SELECT student_id, gpa
FROM student_grades
WHERE semester_end BETWEEN ’01-JAN-2001’ AND ’31-DEC-2001’
OR gpa > 3.;
B. SELECT student_id, gpa
FROM student_grades
WHERE semester_end BETWEEN ’01-JAN-2001’ AND ’31-DEC-2001’
AND gpa gt 3.0;
C. SELECT student_id, gpa
FROM student_grades
WHERE semester_end BETWEEN ’01-JAN-2001’ AND ’31-DEC-2001’
AND gpa > 3.0;
D. SELECT student_id, gpa
FROM student_grades
WHERE semester_end BETWEEN ’01-JAN-2001’ AND ’31-DEC-2001’
OR gpa > 3.0;
E. SELECT student_id, gpa
FROM student_grades
WHERE semester_end > ’01-JAN-2001’ OR semester_end < ’31-DEC-2001’
AND gpa >= 3.0;
Answer: C
Q10. - (Topic 1)
You are currently located in Singapore and have connected to a remote database in
Chicago.
You issue the following command:
Exhibit:
PROMOTIONS is the public synonym for the public database link for the PROMOTIONS table.
What is the outcome?
A. Number of days since the promo started based on the current Singapore data and time.
B. An error because the ROUND function specified is invalid
C. An error because the WHERE condition specified is invalid
D. Number of days since the promo started based on the current Chicago data and time
Answer: D