You are on page 1of 15

OCA CERTIFICATION

1. (1Z0-007q13) Which of the following queries can you use to search for employe
es with the pattern 'A_B' in their names?
A. SELECT last_name FROM employees WHERE last_name LIKE '%A\_B%' ESCAPE '\\';
B. SELECT last_name FROM employees WHERE last_name LIKE '%A_B%' ESCAPE ;
C. SELECT last_name FROM employees WHERE last_name LIKE 'A_B%' ESCAPE '%';
D. SELECT last_name FROM employees WHERE last_name LIKE '%A\_B%' ESCAPE '\';
Answer: D
Explanation:
According to the online documentation provided by Oracle:
You can include the actual characters "%" or "_" in the pattern by using the ESC
APE clause, which identifies the escape character.
If the escape character appears in the pattern before the character "%" or "_" t
hen Oracle interprets this character literally in
the pattern, rather than as a special pattern matching character.
To search for employees with the pattern 'A_B' in their name:
SELECT last_name
FROM employees
WHERE last_name LIKE '%A\_B%' ESCAPE '\'
The ESCAPE clause identifies the backslash (\) as the escape character. In the p
attern, the escape character precedes the underscore
(_). This causes Oracle to interpret the underscore literally, rather than as a
special pattern matching character.
2. (1Z0-007q20) Refer to the SQL codes below:
SELECT manager_id, last_name, hire_date, salary,
AVG(salary) OVER (PARTITION BY manager_id ORDER BY hire_date
ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS c_mavg
FROM employees;
What has been achieved?
A. because of a syntax problem, no row will be returned
B. it calculates, for each employee in the employees table, the average salary o
f the employees reporting to his/her respective manager
C. it calculates, for each employee in the employees table, the average salary o
f the employees reporting to his/her respective manager who were hired just befo
re the employee
D. it calculates, for each employee in the employees table, the average salary o
f the employees reporting to the same manager who were hired in the range just b
efore through just after the employee
E. it calculates, for each employee in the employees table, the average salary o
f the employees reporting to his/her respective manager who were hired just afte
r the employee
Answer: D
Explanation:
According to the online documentation provided by Oracle:
AVG returns average value of expr. You can use it as an aggregate or analytic fu
nction.
If you specify DISTINCT, you can specify only the query_partition_clause of the
analytic_clause. The order_by_clause and windowing_clause are not allowed.
3. (1Z0-007q24) With 9i SQL Plus, what kind of commands can you enter at the com
mand prompt (Choose all that apply)?
A. PL/SQL blocks
B. SQL*Plus commands
C. security commands
D. SQL commands
Answer: ABD
Explanation:
According to the online documentation provided by Oracle:
You can enter three kinds of commands at the command prompt:
* SQL commands, for working with information in the database
* PL/SQL blocks, also for working with information in the database
* SQL*Plus commands, for formatting query results, setting options, and editing
and storing SQL commands and PL/SQL blocks
6. (1Z0-007q124) To write a query that performs an outer join of tables A and B
and returns all rows from B, you need to write
A. any outer join
B. a left outer join
C. a cross join
D. a right outer join
E. an inner join
Answer: D
Explanation:
According to the technical documentation at http://download-west.oracle.com:
To write a query that performs an outer join of tables A and B and returns all r
ows from B (a right outer join), use the ANSI RIGHT [OUTER] syntax, or apply the
outer join operator (+) to all columns of A in the join condition. For all rows
in B that have no matching rows in A, Oracle returns null for any select list e
xpressions containing columns of A.
8. (1Z0-007q51) Which of the following is true if you use the alter tablespace s
tatement and specify the TEMPORARY clause (Choose all that apply)?
A. Oracle no longer perform any checkpoint for the online datafiles in the table
space
B. Oracle performs a checkpoint for all online datafiles in the tablespace
C. Oracle does not ensure that all files are written
D. The offline files may require media recovery before you bring the tablespace
online
E. The offline files may require media recovery after you bring the tablespace o
nline
Answer: BCD
Explanation:
According to the technical documentation at http://download-west.oracle.com:
If you specify TEMPORARY, Oracle performs a checkpoint for all online datafiles
in the tablespace but does not ensure that all files can be written. Any offline
files may require media recovery before you bring the tablespace back online.
9. (1Z0-007q195) Which of the following correctly shows the correct use of the T
RUNC command on a date?
A. SELECT TRUNC(TO_DATE(12-Feb-99,DD-MON-YY, 'YEAR')) "Date " FROM DUAL;
B. TRUNC = TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR', "Date " FROM DUAL;
C. SELECT TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL;
D. date = TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL
Answer: C
Explanation:
According to the technical documentation at http://download-west.oracle.com:
TRUNC returns date with the time portion of the day truncated to the unit specif
ied by the format model fmt. If you omit fmt, date is truncated to the nearest d
ay.
10. (1Z0-007q166) To grant a system privilege with the GRANT statement, you must
(Choose all that apply)?
A. have been granted the GRANT ROLE PRIVILEGE system privilege
B. have been granted the system privilege with the ADMIN OPTION
C. have been granted the GRANT ANY PRIVILEGE system privilege
D. have been granted the system privilege with the GRANT OPTION
Answer: BC
Explanation:
According to the technical documentation at http://download-west.oracle.com:
To grant a system privilege, you must either have been granted the system privil
ege with the ADMIN OPTION or have been granted the GRANT ANY PRIVILEGE system pr
ivilege.
11. (1Z0-007q44) Which of the following are the conditions that must b met befor
e you can use RENAME DATAFILE with the alter tablepace command (Choose all that
apply)?
A. the database must be taken offline before renaming
B. the database must be open
C. when only a single datafile is to be renamed
D. when only a single datafile on the same drive is to be renamed
Answer: AB
Explanation:
According to the technical documentation at http://download-west.oracle.com: Spe
cify RENAME DATAFILE to rename one or more of the tablespace's datafiles. The da
tabase must be open, and you must take the tablespace offline before renaming it
. Each 'filename' must fully specify a datafile using the conventions for filena
mes on your operating system.
This clause merely associates the tablespace with the new file rather than the o
ld one. This clause does not actually change the name of the operating system fi
le. You must change the name of the file through your operating system.
12. (1Z0-007q42) Before making a tablespace read only, which of the following co
nditions must be met (Choose all that apply)?
A. The tablespace must contain an active rollback segments.
B. The tablespace must be online.
C. The tablespace must not contain any active rollback segments.
D. The tablespace must not be involved in an open backup.
E. The tablespace must be involved in an open backup.
Answer: BCD
Explanation:
According to the technical documentation at http://download-west.oracle.com:
Before you can make a tablespace read only, the following conditions must be met
:
* The tablespace must be online.
* The tablespace must not contain any active rollback segments. For this reason,
the SYSTEM tablespace can never be made read only, because it contains the SYST
EM rollback segment. Additionally, because the rollback segments of a read-only
tablespace are not accessible, Oracle recommends that you drop the rollback segm
ents before you make a tablespace read only.
* The tablespace must not be involved in an open backup, because the end of a ba
ckup updates the header file of all datafiles in the tablespace.
--------------------------------------------------------------------------------
--------------------------------------------------
13. (1Z0-007q41) The MANAGE TABLESPACE system privilege allows you to perform wh
ich of the following operations (Choose all that apply)?
A.
Take the tablespace offline
B. Begin a backup
C. End a backup
D. Take the tablespace online
E. Make the tablespace read only
F. Make the tablespace read write
Answer: ABCDEF
Explanation:
According to the technical documentation at http://download-west.oracle.com:
If you have MANAGE TABLESPACE system privilege, you can only perform the followi
ng operations:
* Take the tablespace online or offline
* Begin or end a backup
* Make the tablespace read only or read write
18. (1Z0-007q9) Which of the following has been achieved by the following SQL co
des?
SELECT employee_id FROM employees
WHERE commission_pct = .5 OR salary > 23000;
A. it returns employees who have a 50% of a salary greater than $23,000:
B. it returns employees who have a 50% commission rate or a salary greater than
$23,000:
C. runtime error
D. it returns employees who have a 50% of a salary less than $23,000:
E. invalid syntax
F. it returns employees who have a 50% commission rate and a salary greater than
$23,000:
Answer: B
19. (1Z0-007q8) Which of the following has been achieved by the following SQL co
des?
SELECT * FROM employees
WHERE hire_date < TO_DATE ('01-JAN-1999', 'DD-MON-YYYY')
AND salary > 3500;
A. only those hired before 1999 and earning less than $3500 a month are returned
B. compile time error
C. only those hired after 1999 and earning more than $3500 a month are returned
D. runtime error
E. only those hired before 1999 and earning more than $3500 a month are returned
Answer: E
20. (1Z0-007q19) Which of the following SQL statements can calculate and return
the absolute value of -33?
A. SELECT ABS("-33") Absolute FROM DUAL;
B. SELECT ABS('-33') "Absolute" FROM DUAL;
C. SELECT ABS(-33) "Absolute" FROM DUAL;
D. SELECT ABS(-33), Absolute FROM DUAL;
Answer: C
Explanation:
Purpose
ABS returns the absolute value of n.
The following example returns the absolute value of -15:
SELECT ABS(-15) "Absolute" FROM DUAL;

1.Which two statements about subqueries are true? (Choose two.)


A. A single row subquery can retrieve data from only one table.
B. A SQL query statement cannot display data from table B that is referred to in
its
subquery, unless table B is included in the main query's FROM clause.
C. A SQL query statement can display data from table B that is referred to in it
s
subquery, without including table B in its own FROM clause.
D. A single row subquery can retrieve data from more than one table.
E. A single row subquery cannot be used in a condition where the LIKE operator i
s used
for comparison.
F. A multiple-row subquery cannot be used in a condition where the LIKE operator
is
used for comparison.
Answer: B, D
Explanation:
A SQL query statement cannot display data from table B that is referred to in it
s sub-query,
unless table B is included in the main query's FROM clause. And a single row sub
-query can
retrieve data from more than one table.
Incorrect Answers
A: A single row sub-query can retrieve data from more than one table.
C: A SQL query statement cannot display data from table B that is referred to in
its subquery,
unless table B is included in the main query's FROM clause.
E: A single row sub-query can be used in a condition where the LIKE operator is
used for
comparison.
F: A multiple-row sub-query can be used in a condition where the LIKE operator i
s used for
comparison.
OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 144-150
Chapter 4: Subqueries
2.Examine the description of the STUDENTS table:
STD_ID NUMBER(4)
COURSE_ID VARCHARD2(10)
START_DATE DATE
END_DATE DATE
Which two aggregate functions are valid on the START_DATE column? (Choose two)
A. SUM(start_date)
B. AVG(start_date)
C. COUNT(start_date)
D. AVG(start_date, end_date)
E. MIN(start_date)
F. MAXIMUM(start_date)
Answer: C, E
Explanation:
It is possible to apply COUNT() and MIN() functions on the column with DATE data
type.
Incorrect Answers
A: Function SUM() cannot be used with DATE data type column.
B: Function AVG() cannot be used with DATE data type column.
D: Function AVG() cannot be used with DATE data type column. And function AVG()
just
has one parameter X, not two. It averages all X column values returned by the SE
LECT
statement.
F: There is no MAXIMUM() function in Oracle, only MAX() function exists.
OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 81-85
Chapter 2: Limiting, Sorting, and Manipulating Return Data
3 .Examine the structure of the EMP_DEPT_VU view:
Column Name Type Remarks
EMPLOYEE_ID NUMBER From the EMPLOYEES table
EMP_NAME VARCHAR2(30) From the EMPLOYEES table
JOB_ID VARCHAR2(20) From the EMPLOYEES table
SALARY NUMBER From the EMPLOYEES table
DEPARTMENT_ID NUMBER From the DEPARTMENTS table
DEPT_NAME VARCHAR2(30) From the DEPARTMENTS table
Which SQL statement produces an error?
A. SELECT * FROM emp_dept_vu;
B. SELECT department_id, SUM(salary) FROM emp_dept_vu GROUP BY department_id;
C. SELECT department_id, job_id, AVG(salary) FROM emp_dept_vu GROUP BY departmen
t_id, job_id;
D. SELECT job_id, SUM(salary) FROM emp_dept_vu WHERE department_id IN (10,20) GR
OUP BY job_id HAVING SUM(salary) > 20000;
E. None of the statements produce an error; all are valid.
Answer: E
4.Examine the description of the EMPLOYEES table:
EMP_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(30) NOT NULL
FIRST_NAME VARCHAR2(30)
DEPT_ID NUMBER(2)
JOB_CAT VARCHAR(30)
SALARY NUMBER(8,2)
Which statement shows the department ID, minimum salary, and maximum salary paid
in that department, only if the minimum salary is less than 5000 and maximum sa
lary is more than 15000?
A. SELECT dept_id, MIN (salary), MAX (salary) FROM employees WHERE MIN(salary
) < 5000 AND MAX (salary) > 15000;
B. SELECT dept_id, MIN (salary), MAX (salary) FROM employees WHERE MIN (salary
) < 5000 AND MAX (salary) 15000 GROUP BY dept_id;
C. SELECT dept_id, MIN(salary), MAX(salary) FROM employees HAVING MIN (salary)
< 5000 AND MAX (salary)
D. SELECT dept_id MIN (salary), MAX (salary) FROM employees GROUP BY dept_id H
AVING MIN(salary) < 5000 AND MAX (salary) > 15000
E. SELECT dept_id,MIN (salary), MAX (salary) FROM employees GROUP BY dept_id,
salary HAVING MIN (salary) < 5000 AND MAX (salary) > 15000;
Answer: D
5 .You own a table called EMPLOYEES with this table structure:
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
HIRE_DATE DATE
What happens when you execute this DELETE statement?
DELETE employees;
A. You get an error because of a primary key violation.
B. The data and structure of the EMPLOYEES table are deleted.
C. The data in the EMPLOYEES table is deleted but not the structure.
D. You get an error because the statement is not syntactically correct.
Answer: C
6 .Evaluate this SQL statement:
SELECT e.employee_id, (.15* e.salary) + (.5 * e.commission_pct) + (s.sales_amoun
t * (.35 * e.bonus)) AS CALC_VALUEFROM employees e, sales sWHERE e.employee_id =
s.emp_id;
What will happen if you remove all the parentheses from the calculation?
A. The value displayed in the CALC_VALUE column will be lower.
B. The value displayed in the CALC_VALUE column will be higher.
C. There will be no difference in the value displayed in the CALC_VALUE column.
D. An error will be reported.
Answer: C
7 .Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables:
EMPLOYEES
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
HIRE_DATE DATE
NEW_EMPLOYEES
EMPLOYEE_ID NUMBER Primary Key
NAME VARCHAR2(60)
Which MERGE statement is valid?
A. MERGE INTO new_employees c USING employees e ON (c.employee_id = e.employee_i
d) WHEN MATCHED THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN N
OT MATCHED THEN INSERT VALUES (e.employee_id, e.first_name ||', '||e.last_name);
B. MERGE new_employees c USING employees e ON (c.employee_id = e.employee_id) WH
EN EXISTS THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MAT
CHED THEN INSERT VALUES (e.employee_id, e.first_name ||', '||e.last_name);
C. MERGE INTO new_employees c USING employees e ON (c.employee_id = e.employee_i
d) WHEN EXISTS THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NO
T MATCHED THEN INSERT VALUES(e.employee_id, e.first_name ||', '||e.last_name);
D. MERGE new_employees c FROM employees e ON (c.employee_id = e.employee_id) WHE
N MATCHED THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MAT
CHED THEN INSERT INTO new_employees VALUES (e.employee_id, e.first_name ||', '||
e.last_name);
Answer: A
8 .The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(4)
ENAME VARCHAR2 (25)
JOB_ID VARCHAR2(10)
Which SQL statement will return the ENAME, length of the ENAME, and the numeric
position of the letter "a" in the ENAME column, for those employees whose ENAME
ends with a the letter "n"?
A. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, 'a') FROM EMPLOYEES WHERE SUBSTR(EN
AME, -1, 1) = 'n';
B. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, ,-1,1) FROM EMPLOYEES WHERE SUBSTR(
ENAME, -1, 1) = 'n';
C. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR(E
NAME, 1, 1) = 'n';
D. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR(E
NAME, -1, 1) = 'n';
Answer: A
9 .You would like to display the system date in the format "Monday, 01 June, 200
1".
Which SELECT statement should you use?
A. SELECT TO_DATE (SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual;
B. SELECT TO_CHAR (SYSDATE, 'FMDD, DY Month, YYYY') FROM dual;
C. SELECT TO_CHAR (SYSDATE, 'FMDay, DD Month, YYYY') FROM dual;
D. SELECT TO_CHAR (SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;
E. SELECT TO_DATE (SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;
Answer: C
Explanation:
This answer is correct: "Day" shows the day spelled out, "DD" shows the two-digi
t date,
"Month" provides the month spelled out, "YYYY" shows the four-digit year. "FMDay
" is
special format mask to suppresses the extra spaces between the name of the day a
nd the
number of the date.
Incorrect Answers
A: This statement will return an error because of inappropriate usage of the TO_
DATE()
function.
B: Incorrect format mask "DY" is used to show the number of the day.
D: Incorrect format mask "DY" is used to show the name of the day and format mas
k "DDD"
is used to show the number of the day.
E: Incorrect format mask "DY" is used to show the name of the day and format mas
k "DDD"
is used to show the number of the day. Also this statement will return an error
because of
inappropriate usage of the TO_DATE() function.
OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 87-88
Chapter 2: Limiting, Sorting, and Manipulating Return Data
10 .What is true about joining tables through an equijoin?
A. You can join a maximum of two tables through an equijoin.
B. You can join a maximum of two columns through an equijoin.
C. You specify an equijoin condition in the SELECT or FROM clauses of a SELECT s
tatement.
D. To join two tables through an equijoin, the columns in the join condition mus
t be primary key and foreign key columns.
E. You can join n tables (all having single column primary keys) in a SQL statem
ent by specifying a minimum of n-1 join conditions.
Answer: E
11 .Which four are valid Oracle constraint types? (Choose four.)
A. CASCADE
B. UNIQUE
C. NONUNIQUE
D. CHECK
E. PRIMARY KEY
F. CONSTANT
G. NOT NULL
Answer: B,E,G,D
12 .View the image below to examine the structures of the EMPLOYEES and TAX tabl
es.
You need to find the percentage tax applicable for each employee. Which SQL stat
ement would you use?
A. SELECT employee_id, salary, tax_percent FROM employees e, tax t WHERE e.salar
y BETWEEN t.min_salary AND t.max_salary;
B. SELECT employee_id, salary, tax_percent FROM employees e, tax t WHERE e.salar
y > t.min_salary AND < t.max_salary;
C. SELECT employee_id, salary, tax_percent FROM employees e, tax t WHERE MIN(e.s
alary) = t.min_salary AND MAX(e.salary) = t.max_salary;
D. You cannot find the information because there is no common column between the
two tables.
Answer: A
Explanation:
You can find the percentage tax applicable for each employee by using SQL statem
ent in
answer A.
Incorrect Answers
B: Syntax "WHERE e.salary > t.min_salary, tax_percent" is incorrect.
C: Functions, like MIN() and MAX(), cannot be used in the WHERE clause.
D: The SQL statement from the answer A will provide requested information.
OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 98-103
Chapter 3: Advanced Data Selection in Oracle
13. Click the Exhibit button to examine the structure of the EMPLOYEES, DEPART
MENTS and LOCATIONS tables.
EMPLOYEES
EMPLOYEE_ID
NUMBER
NOT NULL, Primary Key
EMP NAME
VARCHAR2(30)
JOB_ID
VARCHAR2(20)
SALARY
NUMBER
MGR_ID
NUMBER
References EMPLOYEE_ID column
DEPARTMENT_ID
NUMBER
Foreign key to DEPARTMNET_ID column of the DEPARTMENTS table
DEPARTMENTS
DEPARTMENT_ID
NUMBER
NOT NULL, Primary Key
DEPARTMENT_NAME
VARCHAR2(30)
MGR_ID
NUMBER
References MGR_ID column of the EMPLOYEES table
LOCATION_ID
NUMBER
Foreign key to LOCATION_ID column of the LOCATIONS table
LOCATIONS
LOCATIONS_ID
NUMBER
NOT NULL, Primary Key
CITY
VARCHAR2(30)

Which two SQL statements produce the ;name, department name, and the city of all
the employees who earn more than 10000? (Choose Two).
A. SELECT emp_name, department_name, city FROM employees e
JOIN departments d USING (department_id) JOIN locations 1
USING (location_id) WHERE salary > 10000;
B. SELECT emp_name, department_name, city FROM employees e, departments d,
locations 1 JOIN ON (e. department_id = d. department id)
AND (d.location_id = 1.location_id) AND salary > 10000;
C. SELECT emp_name, department_name, city
FROM employees e, departments d, locations 1 WHERE salary > 1000;
D. SELECT emp_name, department_name, city FROM employees e, departments d,
locations 1 WHERE e.department_id = d.department_id AND d.location_id = 1.loc
ation_id AND salary > 10000;
E. SELECT emp_name, department_name, city FROM employees e
NATURAL JOIN departments, locations WHERE salary > 10000;
Answer: AD
14 .Which SQL statement would you use to remove a view called EMP_DEPT_VU from y
our schema?
A. DROP emp_dept_vu;
B. DELETE emp_dept_vu;
C. REMOVE emp_dept_vu;
D. DROP VIEW emp_dept_vu;
E. DELETE VIEW emp_dept_vu;
F. REMOVE VIEW emp_dept_vu;
Answer: D
15 .Which is an iSQL*Plus command?
A. INSERT
B. UPDATE
C. SELECT
D. DESCRIBE
E. DELETE
F. RENAME
Answer: D
16 .The EMPLOYEES table has these columns:
LAST_NAME VARCHAR2(35)
SALARY NUMBER(8,2)
HIRE_DATE DATE
Management wants to add a default value to the SALARY column. You plan to alter
the table by using this SQL statement:
ALTER TABLE EMPLOYEES MODIFY (SALARY DEFAULT 5000);
Which is true about your ALTER statement?
A. Column definitions cannot be altered to add DEFAULT values.
B. A change to the DEFAULT value affects only subsequent insertions to the table
.
C. Column definitions cannot be altered to add DEFAULT values for columns with a
NUMBER data type.
D. All the rows that have a NULL value for the SALARY column will be updated wit
h the value 5000.
Answer: B
Explanation:
A change to the DEFAULT value affects only subsequent insertions to the table. E
xisting
rows will not be affected.
Incorrect Answers
A: Column definitions can be altered to add DEFAULT values.
C: Column definitions can be altered to add DEFAULT values. It works for columns
with a
NUMBER data type also.
D: A change to the DEFAULT value affects only subsequent insertions to the table
. Existing
rows will not be affected.
OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 219-224
Chapter 5: Creating Oracle Database Objects
Question: 1. (A)
Which SELECT statement should you use if you want to display unique combinations
of the
POSITION and MANAGER values from the EMPLOYEE table?
A. SELECT DISTINCT position, manager
FROM employee;
B. SELECT position, manager DISTINCT FROM employee;
C. SELECT position, manager
FROM employee;
D. SELECT position, DISTINCT manager
FROM employee;
Answer: A Explanation:
To display a unique values in the result you can use the DISTINCT key word this
will eliminate the duplicate values from the result of the query.
Question: 2. (A)
Which two are attributes of iSQL*Plus? (Choose two)
A. iSQL*Plus commands cannot be abbreviated.
B. iSQL*Plus commands are accesses from a browser.
C. iSQL*Plus commands are used to manipulate data in tables.
D. iSQL*Plus commands manipulate table definitions in the database.
E. iSQL*Plus is the Oracle proprietary interface for executing SQL statements.
Answer: B, E Question: 3. (A)
You need to perform certain data manipulation operations through a view called E
MP_DEPT_VU, which you previously created.
You want to look at the definition of the view (the SELECT statement on which th
e view was
create.)
How do you obtain the definition of the view?
A. Use the DESCRIBE command in the EMP_DEPT VU view.
B. Use the DEFINE VIEW command on the EMP_DEPT VU view.
C. Use the DESCRIBE VIEW command on the EMP_DEPT VU view.
D. Query the USER_VIEWS data dictionary view to search for the EMP_DEPT_VU view.
E. Query the USER_SOURCE data dictionary view to search for the EMP_DEPT_VU view
.
F. Query the USER_OBJECTS data dictionary view to search for the EMP_DEPT_VU vie
w.
Answer: D Explanation:
To look on the view definition you need to query the USER_VIEWS data dictionary
view and search for the EMP_DEPT_VU view.
Incorrect Answers
A: You cannot see the definition of the view using the DESCRIBE command.
B: There is no DEFINE VIEW command in Oracle.
C: There is no DESCRIBE VIEW command in Oracle.
TK
Exam Name: Introduction to Oracle9i: SQL
Exam Type: Oracle Exam Code: 1Z0-007
Doc. Type: Q & A with explanations Total Questions 301
E: You cannot use the USER_SOURCE data dictionary view to see the definition of
your view: it
is used to store system objects definitions only.
F: You can find record about view in the USER_OBJECTS, but it does not contain t
he definition
of the view itself.
OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 291-301
Chapter 7: Creating Other Database Objects in Oracle
Question: 4. (A)
Which is an /SQL*Plus command?
A. INSERT B. UPDATE C. SELECT
D. DESCRIBE E. DELETE
F. RENAME
Answer: D Explanation:
There is only one SQL*Plus command in this list: DESCRIBE. It cannot be used as
SQL
command. This command returns a description of tablename, including all columns
in that table, the datatype for each column, and an indication of whether the co
lumn permits storage of NULL values.
Incorrect Answers
A: INSERT is not a SQL*Plus command. ItQuestion: 1. (A)
Which SELECT statement should you use if you want to display unique combinations
of the
POSITION and MANAGER values from the EMPLOYEE table?
A. SELECT DISTINCT position, manager
FROM employee;
B. SELECT position, manager DISTINCT FROM employee;
C. SELECT position, manager
FROM employee;
D. SELECT position, DISTINCT manager
FROM employee;
Answer: A Explanation:
To display a unique values in the result you can use the DISTINCT key word this
will eliminate the duplicate values from the result of the query.
Question: 2. (A)
Which two are attributes of iSQL*Plus? (Choose two)
A. iSQL*Plus commands cannot be abbreviated.
B. iSQL*Plus commands are accesses from a browser.
C. iSQL*Plus commands are used to manipulate data in tables.
D. iSQL*Plus commands manipulate table definitions in the database.
E. iSQL*Plus is the Oracle proprietary interface for executing SQL statements.
Answer: B, E Question: 3. (A)
You need to perform certain data manipulation operations through a view called E
MP_DEPT_VU, which you previously created.
You want to look at the definition of the view (the SELECT statement on which th
e view was
create.)
How do you obtain the definition of the view?
A. Use the DESCRIBE command in the EMP_DEPT VU view.
B. Use the DEFINE VIEW command on the EMP_DEPT VU view.
C. Use the DESCRIBE VIEW command on the EMP_DEPT VU view.
D. Query the USER_VIEWS data dictionary view to search for the EMP_DEPT_VU view.
E. Query the USER_SOURCE data dictionary view to search for the EMP_DEPT_VU view
.
F. Query the USER_OBJECTS data dictionary view to search for the EMP_DEPT_VU vie
w.
Answer: D Explanation:
To look on the view definition you need to query the USER_VIEWS data dictionary
view and search for the EMP_DEPT_VU view.
Incorrect Answers
A: You cannot see the definition of the view using the DESCRIBE command.
B: There is no DEFINE VIEW command in Oracle.
C: There is no DESCRIBE VIEW command in Oracle.
TK
Exam Name: Introduction to Oracle9i: SQL
Exam Type: Oracle Exam Code: 1Z0-007
Doc. Type: Q & A with explanations Total Questions 301
E: You cannot use the USER_SOURCE data dictionary view to see the definition of
your view: it
is used to store system objects definitions only.
F: You can find record about view in the USER_OBJECTS, but it does not contain t
he definition
of the view itself.
OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 291-301
Chapter 7: Creating Other Database Objects in Oracle
Question: 4. (A)
Which is an /SQL*Plus command?
A. INSERT B. UPDATE C. SELECT
D. DESCRIBE E. DELETE
F. RENAME
Answer: D Explanation:
There is only one SQL*Plus command in this list: DESCRIBE. It cannot be used as
SQL
command. This command returns a description of tablename, including all columns
in that table, the datatype for each column, and an indication of whether the co
lumn permits storage of NULL values.
Incorrect Answers
A: INSERT is not a SQL*Plus command. It
1. What does the FORCE option for creating a view do?
A.creates a view with constraints
B.creates a view even if the underlying parent table has constraints
C.creates a view in another schema even if you don t have privileges
D.creates a view regardless of whether or not the base tables exist
Answer: D
2. What are two reasons to create synonyms? (Choose two.)
A.You have too many tables.
B.Your tables are too long.
C.Your tables have difficult names.
D.You want to work on your own tables.
E.You want to use another schema s tables.
F.You have too many columns in your tables.
Answer: CE
Free Pass4sure p4s Practice Engine Demo Download PassGuide offers free demos for
each certification exam, including all IT vendors. You can check out the testin
g engine software, or pdf file question quality and usability of our practice ex
ams before you decide to buy it. We are the only one site that offers demos for
almost all IT certification exams.If you want to try passguide exam practice eng
ine
3. 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 so
rted 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
4. In which three cases would you use the USING clause? (Choose three.)
A.You want to create a nonequijoin.
B.The tables to be joined have multiple NULL columns.
C.The tables to be joined have columns of the same name and different data types
.
D.The tables to be joined have columns with the same name and compatible data ty
pes.
E.You want to use a NATURAL join, but you want to restrict the number of columns
in the join condition.
Answer: CDE
5. The CUSTOMERS table has these columns:
CUSTOMER_ID NUMBER(4) NOT NULL
CUSTOMER_NAME VARCHAR2(100) NOT NULL
STREET_ADDRESS VARCHAR2(150)
CITY_ADDRESS VARCHAR2(50)
STATE_ADDRESS VARCHAR2(50)
PROVINCE_ADDRESS VARCHAR2(50)
COUNTRY_ADDRESS VARCHAR2(50)
POSTAL_CODE VARCHAR2(12)
CUSTOMER_PHONE VARCHAR2(20)
The CUSTOMER_ID column is the primary key for the table.
You need to determine how dispersed your customer base is. Which expression find
s the number of different
countries represented in the CUSTOMERS table?
A.COUNT(UPPER(country_address))
B.COUNT(DIFF(UPPER(country_address)))
C.COUNT(UNIQUE(UPPER(country_address)))
D.COUNT DISTINCT UPPER(country_address)
E.COUNT(DISTINCT (UPPER(country_address)))
Answer: E

You might also like