Vous êtes sur la page 1sur 6

Introduction to Oracle 9i SQL ( 1Z0-007 )

Q 1. Which statement explicitly names a constraint?

A. ALTER TABLE student_grades ADD FOREIGN KEY (student_id) REFERENCES


students(student_id);
B. ALTER TABLE student_grades ADD CONSTRAINT NAME = student_id_fk FOREIGN KEY
(student_id) REFERENCES students(student_id);
C. ALTER TABLE student_grades ADD CONSTRAINT student_id_fk FOREIGN
KEY(student_id)
REFERENCES students(student_id);
D. ALTER TABLE student grades ADD NAMED CONSTRAINT student_id_fk FOREIGN KEY
(student_id) REFERENCES students(student_id);
E. ALTER TABLE student grades ADD NAME student_id_fk FOREIGN KEY (student_id)
REFERENCES students(student_id);

Q 2. You created a view called EMP_DEPT_VU that contains three columns from the
EMPLOYEES and DEPARTMENTS tables:

EMPLOYEE_ID, EMPLOYEE_NAME AND DEPARTMENT_NAME.


The DEPARTMENT_ID column of the EMPLOYEES table is the foreign key to the primary key
DEPARTMENT_ID column of the DEPARTMENTS table.
You want to modify the view by adding a fourth column, MANAGER_ID of NUMBER data type
from the EMPLOYEES tables. How can you accomplish this task?

A. ALTER VIEW emp_dept_vu (ADD manager_id NUMBER);

B. MODIFY VIEW emp_dept_vu (ADD manager_id NUMBER);

C. ALTER VIEW emp_dept_vu AS


SELECT employee_id, employee_name,department_name, manager_id FROM employee e,
departments d WHERE e.department_id = d.department_id;

D. MODIFY VIEW emp_dept_vu AS


SELECT employee_id, employee_name, department_name, manager_id
FROM employees e, departments d
WHERE e.department_id = d.department_id;

E. CREATE OR REPLACE VIEW


emp_dept_vu AS
SELECT employee_id,
employee_name, department_name, manager_id
FROM employees e, departments d
WHERE e.department_id = d.department_id;

F. You must remove the existing view first, and then run the CREATE VIEW command with a new
column list to modify a view.

Q 3. Which two are true about aggregate functions? (Choose two.)

A. You can use aggregate functions in any clause of a SELECT statement.


B. You can use aggregate functions only in the column list of the SELECT clause and in the
WHERE clause of a SELECT statement.
C. You can mix single row columns with aggregate functions in the column list of a SELECT
statement by grouping on the single row columns.
D. You can pass column names, expressions, constants, or functions as parameters to an
aggregate function.
E. You can use aggregate functions on a table, only by grouping the whole table as one single
group.

F. You cannot group the rows of a table by more than one column while using aggregate
functions.

Q 4. In a SELECT statement that includes a WHERE clause, where is the GROUP BY clause
placed in the SELECT statement?

A. Immediately after the SELECT clause


B. Before the WHERE clause
C. Before the FROM clause
D. After the ORDER BY clause
E. After the WHERE clause

Q 5. 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 its 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 is used for
comparison.
F. A multiple-row subquery cannot be used in a condition where the LIKE operator is used for
comparison.

Q 6. You added a PHONE-NUMBER column of NUMBER data type to an existing


EMPLOYEES table. The EMPLOYEES table already contains records of 100 employees.
Now, you want to enter the phone numbers of each of the 100 employees into the
table.Some of the employees may not have a phone number available. Which data
manipulation operation do you perform?

A. MERGE
B. INSERT
C. UPDATE
D. ADD
E. ENTER
F. You cannot enter the phone numbers for the existing employee records.

Q 7. Which two statements accurately describe a role? (Choose two.)

A. A role can be given to a maximum of 1000 users.


B. A user can have access to a maximum of 10 roles.
C. A role can have a maximum of 100 privileges contained in it.
D. Privileges are given to a role by using the CREATE ROLE statement.
E. A role is a named group of related privileges that can be granted to the user.
F. A user can have access to several roles, and several users can be assigned the same role.

Q 8. What is necessary for your query on an existing view to execute successfully?

A. The underlying tables must have data.


B. You need SELECT privileges on the view.
C. The underlying tables must be in the same schema.
D. You need SELECT privileges only on the underlying tables.

Q 9. Which script displays '01-JAN-02' when the ENROLL_DATE value is '01-JUL-01'?

A. SELECT ROUND(enroll_date, 'DAY') FROM student;


B. SELECT ROUND(enroll_date, 'YEAR') FROM student;
C. SELECT ROUND(enroll_date, 'MONTH') FROM student;
D. SELECT ROUND(TO_CHAR(enroll_date, 'YYYY')) FROM student;

Q 10. Which three functions can be used to manipulate character, number, or date column
values? (Choose three.)

A. CONCAT
B. ROUND
C. TRUNC
D. RPAD
E. INSTR

Q 11. Which two data types can be converted to LOBs using an ALTER TABLE…MODIFY
command? (Choose two.)

A. RAW
B. LONG
C. VARCHAR
D. LONG RAW

Q 12. The EMPLOYEES table is stored in the SAMPLE tablespace. The corresponding
IPK_EMP index for the EMPLOYEES table’s primary key is stored in the INDX tablespace.
Out of 12 partition, only partition P1 of the SALES table is stored in the SAMPLE
tablespace.

Which objects will be exported by this command? exp system/manager


tablespaces=SAMPLE

A. only the EMPLOYEES table


B. only the EMPLOYEES table and its corresponding primary key index
C. the EMPLOYEES table and partition P1.
D. the EMPLOYEES table, IPK_EMP index, and the SALES table

Q 13. Consider this syntax.


MERGE INTO t1 USING t2 ON (join predicate)… . . What does the MERGE syntax do?

A. It performs a merge join of the row from T2 only if it doesn’t exist in the T1 table.
B. It creates a natural join of tables T1 and T2 for all columns that have the same name.
C. It creates a Cartesian product of table T1 and table T2 for all columns that have the same
name.
D. For each row from T2, it updates the row if it exists within table T1, otherwise it inserts the row
into T1.

Q 14. You need to create the CURRENTPR table. The table must meet these requirements

1. The table must contain the EMPLOYEE_ID and HRS_WORKED columns for numeric data.
2. The table must contain the PAY_DATE column for date values.
3. The table must contain the PAY_RATE and PAY_AMT columns for numeric data with precision
and scale of 5,2 and 10,2 respectively.
4. The table must have a composite primary key on the EMPLOYEE_ID and PAY_RATE columns.

Which CREATE TABLE statement will satisfy these requirements?

A. CREATE TABLE currentpr (


employee_id NUMBER
CONSTRAINT employee_id_pk PRIMARY KEY(employee_id),
pay_date DATE
CONSTRAINT pay_date_pk PRIMARY KEY(pay_date),
hrs_worked NUMBER,
pay_rate NUMBER(5,2),
pay_amt NUMBER(10,2));
B. CREATE TABLE currentpr (
employee_id NUMBER
CONSTRAINT currentpr_pk PRIMARY KEY(employee_id, pay_date),
pay_date DATE,
hrs_worked NUMBER,
pay_rate NUMBER(5,2),
pay_amt NUMBER(10,2));
C. CREATE TABLE currentpr (
employee_id NUMBER,
pay_date DATE,
hrs_worked NUMBER,
pay_rate NUMBER(5,2),
pay_amt NUMBER(10,2),
CONSTRAINT employee_id_pk PRIMARY KEY(employee_id),
CONSTRAINT pay_date_pk PRIMARY KEY(pay_date));
D. CREATE TABLE currentpr (
employee_id NUMBER,
pay_date DATE,
hrs_worked NUMBER,
pay_rate NUMBER(5,2),
pay_amt NUMBER(10,2),
CONSTRAINT currentpr_pk PRIMARY KEY(employee_id, pay_date));

Q 15. For which two types of constraints will a unique index be automatically created?
(Choose two.)

A. UNIQUE
B. PRIMARY KEY
C. NOT NULL
D. FOREIGN KEY
E. CHECK

Q 16. 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?

A. The statement will achieve the desired results.


B. The statement will execute, but will NOT enable the PRIMARY KEY constraint.
C. The statement will execute, but will NOT verify that values in the ID column do NOT violate the
constraint.
D. The statement will return a syntax error.

Q 17. Which four statements about Oracle constraints are true? (Choose four.)

A. A UNIQUE constraint specifies a column or combination of columns whose values must be


unique for all rows in a table.
B. A CHECK constraint specifies a condition that must be true.
C. A PRIMARY KEY constraint uniquely identifies each row of a table.
D. A NOT NULL constraint ensures that null values are NOT allowed in a column.
E. A UNIQUE constraint prohibits the input of nulls because nulls do NOT satisfy the constraint
conditions.
F. A PRIMARY KEY constraint allows null values in a column when the column is part of a set of
columns that uniquely identifies each row.

Q 18. Which statement about a table is true?

A. A table can have up to 10,000 columns.


B. The size of a table does NOT need to be specified.
C. A table CANNOT be created while users are using the database.
D. The structure of a table CANNOT be modified while the table is online.

Q 19. Which CREATE TABLE statements will fail? (Choose all that apply.)

A. CREATE TABLE time1 (time1 NUMBER(9));


B. CREATE TABLE date (time_id NUMBER(9));
C. CREATE TABLE time (time_id NUMBER(9));
D. CREATE TABLE time* (time_id NUMBER(9));
E. CREATE TABLE $time (time_id NUMBER(9));
F. CREATE TABLE datetime (time_id NUMBER(9));

Q 20. Evaluate this statement:

DELETE FROM workorder; What does this statement accomplish?

A. discards only the structure of the WORKORDER table


B. deletes the WORKORDER column
C. deletes all the rows from the WORKORDER table
D. deletes all the values in the columns that do NOT have NOT NULL constraints
E. generates an error because the FROM keyword should NOT be included
F. deletes all rows from the WORKORDER table and permanently discards the table's structure

Q 21. Which of the following correctly shows the correct use of the TRUNC command on a
date?

A. SELECT TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL;


B. date = TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL;
C. TRUNC = TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR', "Date " FROM DUAL;
D. SELECT TRUNC(TO_DATE(12-Feb-99,DD-MON-YY, 'YEAR')) "Date " FROM DUAL;
Q 22. To grant a system privilege with the GRANT statement, you must (Choose all that
apply)?

A. have been granted the GRANT ANY PRIVILEGE system privilege


B. have been granted the system privilege with the GRANT OPTION
C. have been granted the system privilege with the ADMIN OPTION
D. have been granted the GRANT ROLE PRIVILEGE system privilege

To write a query that performs an outer join of tables A and B and returns all rows from B, you
need to write
Ans A,C
A. a left outer join
B. any outer join
C. a right outer join
D. an inner join
E. a cross join

Q 23. Which of the following is true if you use the alter tablespace statement and specify
the TEMPORARY clause (Choose all that apply)?

A. Oracle performs a checkpoint for all online datafiles in the tablespace


B. Oracle does not ensure that all files are written
C. The offline files may require media recovery after you bring the tablespace online
D. The offline files may require media recovery before you bring the tablespace online
E. Oracle no longer perform any checkpoint for the online datafiles in the tablespace

Key for Introduction to Oracle 9i SQL ( 1Z0-007 )

1. C
2. E
3. C&D
4. E
5. B&D
6. C
7. E&F
8. B
9. B
10. AD&E
11. B&D
12. D
13. D
14. D
15. A&B
16. A
17. ABC&D
18. B
19. BD&E
20. C
21. A
22. C
23. A,B,D

Vous aimerez peut-être aussi