1. Which database object among the following provides a layer of abstraction between the users and the data?
Answer: C, D. Views and Synonyms do not store data themselves. A view is a temporary or virtual table used to retrieve data stored in underlying database tables.
2. Which of the following data base objects can generate serial numbers?
Answer: D. A sequence can be created to generate a series of integers. The values generated by a sequence can be stored in any table. A sequence is created with the CREATE SEQUENCE command.
3. What is true about views?
Answer: C, D. DML operations aren't permitted on views that include group functions, a GROUP BY clause, the ROWNUM pseudocolumn, or the DISTINCT keyword.
4. Why are views useful? (Choose the most appropriate answer)
Answer: B, C. A view is a temporary or virtual table used to retrieve data stored in underlying database tables. The view query must be executed each time the view is used. A view can be used to simplify queries or restrict access to sensitive data.
5. In which of the below scenarios, DML operations on a view are not possible?
Answer: D. DML operations aren't permitted on views that include group functions, a GROUP BY clause, the ROWNUM pseudocolumn, or the DISTINCT keyword.
6. Where can views get their data from?
Answer: C.
Consider the given table structure and the following statement and answer the questions 7 to 9 that follow:
SQL> DESC employees Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) EMAIL NOT NULL VARCHAR2(25) PHONE_NUMBER VARCHAR2(20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4)
CREATE VIEW emp_details AS SELECT hire_date, job, salary, department_id FROM employees;
7. You issue the below query. How many columns will the user see as a result of the below query?
SELECT * FROM emp_details WHERE department_id= 100;
Answer: D. Since the view definition is based on four columns from the EMPLOYEES table, a query on a view with all column will show those four columns only.
8. You need to get the department name in addition to the above 4 columns. Which of the following query will give you the required results?
SELECT E.*, dept_name FROM departments D join emp_details E ON (E.department_id= D.dept_id);
SELECT hire_date, job, salary, dept_name FROM emp_details
Answer: A. A view can be joined with other tables or views in a SELECT query.
9. You need to find the maximum salary along with the department name in addition to the 4 columns selected in the view. Which of the following query will give you the required results?
Select dept_name, e.salary FROM departments D join emp_details E On (E.department_id= D.dept_id);
Select dept_name, max(salary) FROM departments D join emp_details E On (E.department_id= D.dept_id) Group by dept_name;
Select dept_name, max(salary) FROM departments D join emp_details E On (E.department_id= D.dept_id);
Answer: B.
10. What among the following is true about synonyms?
Answer: A, C. A synonym can be a private synonym, which users use to reference objects they own,or a public synonym, which users use to access another user's database objects. Only SYSDBA or a user with DBA privileges can create a public synonym.
11. What is true about creating a view? (Choose the most appropriate answer)
Answer: C. A view containing expressions or functions or joining multiple tables is considered a complex view. A complex view can be used to update only one table.
12. Which of the following privileges are required to create views in one's own schema?
Answer: B. CREATE VIEW privilege is required by a user to create a view in its own schema.
13. Which of the following privileges are required to create views in someone else's schema?
Answer: A. CREATE ANY VIEW privilege is required by a user to create a view in other user's schema.
14.Which of the following are supported for an object view or relational view?
Answer: D.
15. What among the following are different types of Views?
Answer: C. Simple and Complex views are two types of views. Simple views are based on a subquery that references only one table and doesn't include group functions, expressions, or GROUP BY clauses. Complex views are based on a subquery that retrieves or derives data from one or more tables and can contain functions or grouped data.
16. What is true about a simple view?
Answer: D. Simple views are based on a subquery that references only one table and doesn't include group functions, expressions, or GROUP BY clauses.
17.What is true about a complex view?
Answer: D. Complex views are based on a subquery that retrieves or derives data from one or more tables and can contain functions or grouped data.
18.Which keyword combination should be used to implicitly drop a view (if it exists) and create a new view with the same name?
Answer: C. The OR REPLACE option notifies Oracle 11g that a view with the same name might already exist; if it does, the view's previous version should be replaced with the one defined in the new command.
19.How is a view stored in the data dictionary?
Answer: D.
20.Which of the following can contain single-row functions?
Answer: A, B. Single-row functions can be used in Inline as well as Simple views.
21.Which of the following can contain a group of data?
Answer: C. Complex view can use group function in the query.
22.What among the following is true about a View?
Answer: A. View definition can make use of sub-queries.
23.Which of the following can create a view even if the base table(s) does not exist?
Answer: B. Ff you include the FORCE keyword in the CREATE clause, Oracle 11g creates the view in spite of the absence of any referenced tables. NOFORCE is the default mode for the CREATE VIEW command, which means all tables and columns must be valid, or the view isn't created.
24.Which of the following commands ensures that no DML operations can be performed on a view?
Answer: C. The WITH READ ONLY option prevents performing any DML operations on the view. This option is used often when it's important that users can only query data, not make any changes to it.
25.What is true about the NOFORCE option in CREATE VIEW statement?
Answer: B, C. NOFORCE is the default mode for the CREATE VIEW command, which means all tables and columns must be valid, or the view isn't created.
26.What is true about the OR REPLACE keyword?
Answer: B. The OR REPLACE option notifies Oracle 11g that a view with the same name might already exist; if it does, the view's previous version should be replaced with the one defined in the new command.
27.What is true with respect to accessing the below view? (Assume the table structure given)
SQL> DESC employees Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) EMAIL NOT NULL VARCHAR2(25) PHONE_NUMBER VARCHAR2(20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4)
CREATE VIEW salVU100 AS SELECT employee_id ID_NUMBER, last_name NAME, salary*12 ANNUAL_SAL FROM employees E WHERE department_id= 100;
Answer: B, C. View must refer the column alias if the view definition contains alias for the columns.
28.What is true with respect to accessing the below view? (Assume the table structure given)
SQL> DESC employees Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) EMAIL NOT NULL VARCHAR2(25) PHONE_NUMBER VARCHAR2(20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4)
CREATE VIEW salVU100 (ID_NUMBER, NAME, ANNUAL_SAL) AS SELECT employee_id , last_name, salary*12 FROM employees E WHERE department_id= 100;
Answer: B. If the alias are specified in the view header, same number of columns must be selected in the SELECT query.
29. Consider the following statement and the given table structure:
SQL> DESC employees Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) EMAIL NOT NULL VARCHAR2(25) PHONE_NUMBER VARCHAR2(20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4)
SQL> DESC departments Name Null? Type ----------------------- -------- ---------------- DEPARTMENT_ID NOT NULL NUMBER(4) DEPARTMENT_NAME NOT NULL VARCHAR2(30) MANAGER_ID NUMBER(6) LOCATION_ID NUMBER(4)
CREATE OR REPLACE VIEW empVU100 (ID_NUMBER, NAME, ANNUAL_SAL, DEPT_ID) AS SELECT employee_id , first_name ||' '|| last_name, salary, department_id FROM employees WHERE department_id= 100;
What is true about the column aliases as in the above query?
Answer: B.
Consider the following statement and answer the questions 30 to 34 that follow:
CREATE OR REPLACE VIEW dept_sum_vu (name, minsal, maxsal, avgsal) AS SELECT d.dept_name, MIN(e.salary), MAX(e.salary), AVG (e.salary) FROM employees e JOIN departments d ON (e.department_id= d.dept_id) GROUP BY d.dept_name;
30.What can be said about the statement given above?
Answer: C. Specifying alias name is good practice to improve the readability of the code and the view queries.
31.What will happen if the above statement is modified as below?
CREATE OR REPLACE VIEW dept_sum_vu(name, maxsal, minsal, avgsal) AS SELECT d.dept_name, MIN(e.salary), MAX(e.salary), AVG (e.salary) FROM employees e JOIN departments d ON (e.department_id= d.dept_id) GROUP BY d.dept_name;
Answer: B. The sequence of the column alias not matters much as they don't carry any behavioral attribute.
32.Determine the output of the below DELETE statement.
DELETE FROM dept_sum_vu;
Answer: C. The view DEPT_SUM_VU is a complex view. DML operations cannot be performed on a complex view.
33.Suppose you modify the query given above to the following:
CREATE OR REPLACE VIEW dept_sum_vu(name, sal) AS SELECT d.dept_name, e.salary FROM employees e JOIN departments d ON (e.department_id= d.dept_id) Where rownum < 10;
What will be the impact of the modification?
Answer: B. DML operations cannot be performed on complex views. DEPT_SUM_VU is a complex view as it joined multiple tables. DDL operations are not possible on views.
34.Suppose you select DISTINCT departments and employee salaries in the view query used in above question. What will be the outcome if you try to remove rows from the view dept_sum_vu?
Answer: C. The view DEPT_SUM_VU is still a complex view as it uses DISTINCT keyword. Hence, DML operations are not possible on it.
35.When can the rows from a view be removed?
Answer: B. DML operations are possible only on simple views.
36.When can the data in a view not be modified?
Answer: D. UPDATE is not possible on a view containing group functions, pseudocolumns or DISTINCT keyword.
37. The JOB_HISTORY table is owned by a user "Andy". Andy grants the SELECT privilege on the JOB_HISTORY table to another user "HR". Which statement would create a synonym EMP_JOBS so that "HR" can execute the following query successfully?(Assume the structure of tables as given)
SQL> desc job_history Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) START_DATE NOT NULL DATE END_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) DEPARTMENT_ID NUMBER(4)
SELECT * from EMP_JOBS;
CREATE SYNONYM EMP_JOBS for JOB_HISTORY
CREATE SYNONYM EMP_JOBS for andy.JOB_HISTORY
CREATE PUBLIC SYNONYM EMP_JOBS FOR andy.JOB_HISTORY
Answer: B. Only SYSDBA or a user with DBA privileges can create public synonyms.
38.Which keyword can assure that the DML operations performed on the view stay in the domain of the view?
Answer: C. The WITH CHECK OPTION constraint ensures that any DML operations performed on the view (such as adding rows or changing data) don't prevent the view from accessing the row because it no longer meets the condition in the WHERE clause.
Consider the following table structure and the given statement and answer the questions 39 and 40 that follow:
SQL> DESC employees Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) EMAIL NOT NULL VARCHAR2(25) PHONE_NUMBER VARCHAR2(20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4)
CREATE OR REPLACE VIEW empvu100 AS SELECT * FROM employees WHERE department_id= 100 WITH CHECK OPTION CONSTRAINT empvu100_ck;
39.What will the above statement do?
Answer: B. The WITH CHECK OPTION constraint ensures that any DML operations performed on the view (such as adding rows or changing data) don't prevent the view from accessing the row because it no longer meets the condition in the WHERE clause. An ORA error will be thrown if an INSERT or UPDATE will be executed on any row with a department_id other than 100.
40.Suppose you fire an UPDATE statement as shown below:
UPDATE empvu100 Set department_id = 200 Where employee_id = 121;
What will be the outcome of this statement?
Answer: C. If the view with CHECK OPTION is updated and new record's value violates the scope of the view, ORA exception "ORA-01402: view WITH CHECK OPTION where-clause violation" is raised.
41.What is true about the WITH CHECK CONSTRAINT?
Answer: A.
42.How can you prevent DML operations on a View?
Answer: B. The WITH READ ONLY option prevents performing any DML operations on the view. This option is used often when it's important that users can only query data, not make any changes to it.
Consider the table structure and the given statement and answer the questions 43, 44 and 45 that follow:
SQL> DESC employees Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) EMAIL NOT NULL VARCHAR2(25) PHONE_NUMBER VARCHAR2(20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4)
CREATE OR REPLACE empvu100(employee_id , first_name, job) AS SELECT employee_id , last_name, job FROM employees WHERE department_id = 100 WITH READ ONLY;
43.What is true about the above statement?
Answer: B, C. DML operations are not permitted on view which are created with READ ONLY option.
44.How many rows can be deleted from the view as shown above?
Answer: C. DML operations are not permitted on view which are created with READ ONLY option.
45.Which of the following statements will drop the view created as above?
DROP READ ONLY VIEW empvu100;
DROP NOFORCE empvu100;
DROP VIEW empvu100;
Answer: C. Read only view can be dropped using the DROP VIEW command.
46.What is true about dropping a View?
Answer: B, C.
47.Which of the following privileges should a user have to drop a view?
Answer: C.
48.What is true about sequences?
Answer: D. A sequence speeds up the efficiency of accessing sequence values when cached in memory
49.What is true about a sequence?
Answer: B, C. CREATE SEQUENCE system privilege is required by a user to create a sequence in its own schema which cannot be shared by other users.
50.What among the following options is true about Sequences?
Answer: D.
Consider the following statement and answer the questions 51 to 59 that follow:
CREATE SEQUENCE dept_deptid_seq INCREMENT BY 100 START WITH 101 MAXVALUE 9999 NOCACHE NOCYCLE;
51.What will be the first value generated by this sequence?
Answer: C. The START WITH clause establishes the starting value for the sequence. Oracle 11g begins each sequence at 1 unless another value is specified in the START WITH clause.
52.What can be the last value generated by this sequence?
Answer: D. The MINVALUE and MAXVALUE clauses establish a minimum or maximum value for the sequence.
53.What will be the 2nd value generated by this sequence?
Answer: A. The INCREMENT BY clause specifies the interval between two sequential values. If the sequence is incremented by a positive value, the values the sequence generates are in ascending order. However, if a negative value is specified, the values the sequence generates are in descending order. If the INCREMENT BY clause isn't included when the sequence is created, the default setting is used, which increases the sequence by one for each integer generated.
54.What will be the next value after the maximum integer 9999 is reached by this sequence?
Answer: B. The CYCLE and NOCYCLE options determine whether Oracle 11g should begin reissuing values from the sequence after reaching the minimum or maximum value.
55.How many values will Oracle pre allocate in memory based on the sequence given above?
Answer: A.
56.You execute the below query:
SELECT dept_depid_seq.NEXTVAL from dual;Assuming that the last value the sequence generated was 200, what will be the outcome of this query?
Answer: D. The NEXTVAL pseudocolumn will generate the next unique integer of the sequence.
57.You execute the below query:
SELECT dept_depid_seq.CURRVAL from dual;Assuming that the last value the sequence generated was 200, what will be the outcome of this query?
Answer: A. The CURRVAL pseudocolumn will generate the current unique integer already generated by the sequence.
58.Suppose you need to change the start value of this sequence to 1000. Which of the following statements will help?
ALTER dept_deptid_seq INCREMENT BY 100 START WITH 1000 MAXVALUE 9999 NOCACHE NOCYCLE;
ALTER SEQUENCE dept_deptid_seq START WITH 101
ALTER SEQUENCE dept_deptid_seq INCREMENT BY 100 START WITH 101 CYCLE;
Answer: B. Starting number of a sequence cannot be modified. Oracle raises the exception "ORA-02283: cannot alter starting sequence number".
59.Suppose that the above sequence is altered as below:
ALTER SEQUENCE dept_deptid_seq INCREMENT BY 100 START WITH 101 MAXVALUE 99 NOCACHE NOCYCLE;
What will be the outcome of this alteration?
Answer: A. The MAXVALUE cannot be less than the START WITH value while altering a sequence.
60.When can we use the CYCLE option in Sequences?
Answer: C. The CYCLE and NOCYCLE options determine whether Oracle 11g should begin reissuing values from the sequence after reaching the minimum or maximum value. If the CYCLE option is specified and Oracle 11g reaches the maximum value for an ascending sequence or the minimum value for a descending sequence, the CYCLE option initiates the cycle of numbers again.
61.What is true about NEXTVAL pseudo column?
Answer: B. The pseudocolumn NEXTVAL (NEXT VALUE) is used to actually generate the sequence value. In other words, it calls the sequence object and requests the value of the next number in the sequence. After a value is generated, it's stored in the CURRVAL (CURRENT VALUE) pseudocolumn so that you can reference it again.
62.What is true about CURRVAL pseudo column?
Answer: B.
63.When can NEXTVAL and CURRVAL be used?
Answer: C, D. The sequence can be used in SELECT query, PL/SQL cursor or in IAS (INSERT-AS-SELECT)direct operations.
64.When can NEXTVAL and CURRVAL not be used?
Answer: D.
Consider the given statement and answer the questions 65 and 66 that follow:
CREATE TABLE employees (employee_id NUMBER(4) DEFAULT emp_empid_seq.CURRVAL, department_id NUMBER(4));
65.What will be the outcome of this statement? (Assume that emp_empid_seq is sequence used to generate employee ID values)
Answer: D. Pseudocolumns cannot be specified in DEFAULT clause of a column definition.
66.What will be the outcome of this statement if the CURRVAL is replaced with NEXTVAL? (Assume that emp_empid_seq is generated to generate employee ID values)
Answer: D. Pseudocolumns cannot be specified in DEFAULT clause of a column definition.
Examine the given exhibit giving the structures of the tables Departments and Location. Answer the questions 67 and 68 that follow:
SQL> DESC departments Name Null? Type ----------------------- -------- ---------------- DEPARTMENT_ID NOT NULL NUMBER(4) DEPARTMENT_NAME NOT NULL VARCHAR2(30) MANAGER_ID NUMBER(6) LOCATION_ID NUMBER(4)
SQL> desc locations Name Null? Type ----------------------- -------- ---------------- LOCATION_ID NOT NULL NUMBER(4) STREET_ADDRESS VARCHAR2(40) POSTAL_CODE VARCHAR2(12) CITY NOT NULL VARCHAR2(30) STATE_PROVINCE VARCHAR2(25) COUNTRY_ID CHAR(2)
67.You need to insert a new department named "HR" in the location ID 1000. Which of the following statements will give you the required results?
INSERT INTO departments (dept_id, dept_name, location_id) VALUES (dept_deptid_seq.NEXTVAL, 'HR', 1000);
INSERT INTO departments (dept_id, dept_name, location_id) VALUES (dept_deptid_seq.NEXTVAL, "HR", 1000);
INSERT INTO departments (dept_id, dept_name, location_id) VALUES (dept_deptid_seq.CURRVAL, 'HR', 1000);
Answer: A.The option C will cause a 'Unique constraint violation' as it will try to insert current value of department id which aleady exists in the DEPARTMENTS table.
68.Suppose you execute the below query before inserting the values as shown in the option A in question 67. What will be the outcome of the query?
SELECT dept_deptid_seq.CURRVAL FROM DUAL;
Answer: B. When a user logs in to Oracle 11g, no value is initially stored in the CURRVAL pseudocolumn; the current value is NULL. After a NEXTVAL call has been issued to generate a sequence value, CURRVAL stores that value until the next value is generated. CURRVAL contains only the last value generated.
69.How can gaps occur in the values of a sequence?
Answer: D.
70.What is true about caching sequence values?
Answer: C. If the NOCACHE option is specified when the sequence is created, each number is generated when the request is received. However, if an organization's transactions require large amounts of sequential numbers throughout a session, the CACHE option can be used to have Oracle 11g generate a set of values ahead of time and store them in the server's memory. Then, when a user requests a sequence value, the next available value is assigned-without Oracle 11g having to generate the number. On the other hand, if the CACHE option isn't specified, Oracle 11g assumes a default option of CACHE 20 and stores 20 sequential values in memory automatically for users to access.
71.The following query for the sequence EMP_EMPID_SEQ is executed after a transaction which inserted five employee details.
Select emp_empID_seq.CURRVAL from dual;
Suppose the employee transaction rolled back. What will be the result of the above query?
Answer: C. Sequence values are unaffected by commit or rollback. If a transaction which uses sequence generator is rolled back, the sequence values are wasted and cannot be recovered.
72.Which of the following privileges are required to modify a sequence?
Answer: B. To alter a sequence, the sequence must be in your own schema, or you must have the ALTER object privilege on the sequence, or you must have the ALTER ANY SEQUENCE system privilege.
73.What happens when a sequence is altered?
Answer: B. By using the ALTER SEQUENCE command, any changes are applied only to values generated after the modifications are made.
74.Suppose you need to drop a sequence. Which of the following commands will help?
ALTER SEQUENCE sequence_name START WITH NULL;
DROP sequence_name;
DROP SEQUENCE sequence_name;
Answer: C. The DROP command is used to drop a sequence
75.Which of the following privileges will allow you to drop a sequence? (Choose the most appropriate answer)
Answer: D. To drop a sequence, either the sequence must be in your own schema or you must have the DROP ANY SEQUENCE system privilege.
76.What is true about Indexes?
Answer: D. Indexes can be created manually as well as automatically following certain actions like creating a primary key or unqiue constraint.
77.Which of the following is used by an index to locate the data quickly?
Answer: B. An Oracle 11g index is a database object that stores a map of column values and the ROWIDs of matching table rows. A ROWID is the physical address of a table row.
78.What happens when there is no index on a column of a table?
Answer: B.
79.What among the following is true about an Index?
Answer: D.
80.What will happen if an index is dropped?
Answer: D. Indexes are the objects which are physically stored in schema. Dropping an index doesn't impacts other objects.
81.What happens when a table is dropped?
Answer: B.
82.How are indexes created automatically?
Answer: C, D.
83.For which of the following objects, a synonym can be created?
Answer: B, C, D. The schema object for which you are creating the synonym can be of the following types:Table or object table, View or object view, Sequence, Stored procedure, function, or package, Materialized view, Java class schema object, User-defined object type, Synonym
84. Which of the following can you use to reference a table owned by another user?
Answer: C. A synonym is an alternative name or alias for a database object.
85.What among of the following is an example of a Non-unique index?
Answer: C.
86.Which of the following is the main and basic type of an Index?
Answer: A, B. The B-tree (balanced-tree) index is the most common index used in Oracle. You can create this type of index with a basic CREATE INDEX statement. A bitmap index varies in structure and use from a B-tree index. This index is useful for improving queries on columns that have low selectivity (low cardinality, or a small number of distinct values).
87.You need to speed up a query by creating an index on the FIRST_NAME of the EMPLOYEES table. Which of the following statements can you use? (Assume the table structure as shown)
SQL> DESC employees Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) EMAIL NOT NULL VARCHAR2(25) PHONE_NUMBER VARCHAR2(20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4)
CREATE INDEX emp_first_name_idx ON employees (first_name);
CREATE INDEX emp_first_name_idx ON employees first_name;
ALTER INDEX emp_first_name_idx ON employees (first_name);
Answer: A.
88.What does the UNIQUE keyword do while creating indexes?
Answer: A. A unique index is typically created automatically when a PRIMARY KEY or UNIQUE constraint is defined on a column. Unique indexes can also be explicitly created by including the UNIQUE keyword in the CREATE INDEX statement.
89.What will happen when you specify the keyword BITMAP while creating an Index?
Answer: C.
90.You have queries written which are expected to retrieve less than 2% to 4% of rows. Which of the following can be applied on the relevant tables to achieve the query performance of such query? (Choose the best answer)
Answer: A. Indexes are the best way to achieve query performance. Heavy IO operations can be reduced and simplified using index scans.
91.In what scenarios can Indexes be useful?
Answer: C, D.
92.The table EMPLOYEES is updated frequently. When can Indexes be created on this table? (Choose the most appropriate answer)
Answer: A. Frequent or bulk DML operations on a table with an index add an overhead of maintaining the index segment, which might affect the DML operation performance.
93.Consider the following query and answer the following query. Assume that the EMPLOYEE_ID , DEPARTMENT_ID and FIRST_NAME columns of EMPLOYEES table are indexed. (Assume the table structure as given)
SQL> DESC employees Name Null? Type ----------------------- -------- ---------------- EMPLOYEE_ID NOT NULL NUMBER(6) FIRST_NAME VARCHAR2(20) LAST_NAME NOT NULL VARCHAR2(25) EMAIL NOT NULL VARCHAR2(25) PHONE_NUMBER VARCHAR2(20) HIRE_DATE NOT NULL DATE JOB_ID NOT NULL VARCHAR2(10) SALARY NUMBER(8,2) COMMISSION_PCT NUMBER(2,2) MANAGER_ID NUMBER(6) DEPARTMENT_ID NUMBER(4)
SELECT first_name, last_name FROM employees WHERE comm IS NULL;
Will the existing indexes help in this case if there are 1 million rows in the table EMPLOYEES?
Answer: B. Indexes are not used when the query predicates do not contain the columns on which the index is created.
94.Which of the following will remove an Index?
DELETE FROM index_name;
DROP INDEX index_name;
DROP INDEX;
Answer: B. You must have the DROP ANY INDEX privilege to drop an index.