Introduction to Oracle 9i: SQL Question No:- 1 Evaluate the SQL statement: SELECT LPAD (salary,10,*) FROM EMP WHERE EMP

_ ID = 1001; If the employee with the EMP_ID 1001 has a salary of 17000, what is displayed? A. 17000.00 B. 17000***** C. ****170.00 D. **17000.00 E. an error statement Answer: C Question No:- 2 Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? (Choose three) A. INSERT INTO employees VALUES ( NULL, 'John','Smith'); B. INSERT INTO employees( first_name, last_name) VALUES('John','Smith'); C. INSERT INTO employees VALUES ('1000','John',NULL); D. INSERT INTO employees(first_name,last_name, employee_id) VALUES ( 1000, 'John','Smith'); E. INSERT INTO employees (employee_id) VALUES (1000); F. INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, 'John',''); Answer: C, E, F Explanation: Since EMPLOYEE_ID column is used as primary key, it cannot be NULL, so only INSE RT statements in C, E and F are correct. You can insert the row with NULL LAST_N AME as in answer C, or only the row with EMPLOYEE_ID as in answer E, or the row with empty LAST_NAME column. Incorrect Answers A: This answer is incorrect because a primary key cannot be NULL. B: INSERT statement does not contain primary key value at all, so this answer ne eds to be eliminated as correct one. D: This statement shows incorrect order of columns of row which needs to be inse rted into the table. OCP Introduction to Oracle 9i: SQL Exam Guide, Jason Couchman, p. 260-267 Chapter 6: Manipulating Oracle Data Question No:- 3 You need to give the MANAGER role the ability to select from, insert into, and m odify existing rows in the STUDENT_GRADES table. Anyone given this MANAGER role should be able to pass those privileges on to others. Which statement accomplish es this? A. GRANT select, insert, update ON student_grades TO manager; B. GRANT select, insert, update

modify ON student_grades TO manager WITH GRANT OPTION. C: There is no option with name MODIFY in the GRANT command.department_id NOT IN (10. insert. Incorrect Answers A: This statement would be correct if it included WITH GRANT OPTION clause to al low this role to pass those privileges on to others. prefix the column in the USING clause with the table alias E. F. B: This statement uses incorrect clause TO ROLE. insert.emp_name. update ON student_grades TO ROLE manager WITH GRANT OPTION. D. F. because many users frequently use this table. update ON student_grades TO manager WITH GRANT OPTION. F: There is no option with name MODIFY in the GRANT command. GRANT select. insert. replace the condition "d. d. Answer: D Explanation: This answer provides correct syntax of GRANT command to give the MANAGER role al l asked privileges. remove the table alias from the SELECT clause D.dept_name FROM employees e JOIN departments d USING (department_id) WHERE d. And this statement also uses incorrect clause TO ROLE. The statement fails when executed. Jason Couchman. GRANT select. OCP Introduction to Oracle 9i: SQL Exam Guide. insert.40) ORSER BY dept_name. C.5 The database administrator of your company created a public synonym called HR fo r the HUMAN_RESOURCES table of the GENERAL schema. E. 356-365 Chapter 8: User Access Control in Oracle Question No:. modify ON student_grades TO ROLE manager WITH GRANT OPTION.department_id NOT IN (10.40)" in the WHERE clause with "d. p. .GRANT select. E: This statement uses incorrect clause TO ROLE.department_id <> 40" Answer: C Question No:.department_id <> 10 AND d. Which change fixes the error? A.4 Evaluate this SQL statement: SELECT e. Clause WITH GRANT OPTION will allow this role to pass those privileges on to others. remove the table alias prefix from the WHERE clause C. prefix the column in the ORDER BY clause with the table alias F. remove the ORDER BY clause B. GRANT select.ON student_grades TO ROLE manager.

You obtain the results retrieved from the HR table that belongs to your schem a. OCP Introduction to Oracle 9i: SQL Exam Guide.6 Which two statements about views are true? (Choose two. D. Jason Couchman. it is possible to change dat a in the underlying table(s) with some restrictions. A view can be created as read only. C. However. A. as a Cartesian product. You obtain the results retrieved from the public synonym HR created by the da tabase administrator. Incorrect Answers C: Query operations containing ORDER BY clause are also permitted. A view must have aliases defined for the column names in the SELECT statement . B. E. C: There is no error: data from the table in your own schema will be retrieved b y this query. E: It is not required to have aliases defined for the column names in the SELECT statement. p. Incorrect Answers A: The results will be retrieved from the table in your own schema. C. D: This query will not generate Cartesian product from both tables.A view also can be created a s a join on two or more tables. Answer: A. D. A view can be created as a join on two or more tables. You get an error message because you cannot retrieve from a table that has th e same name as a public synonym.) A. A view cannot have an ORDER BY clause in the SELECT statement. it will not work with HR synonym for the HUMAN_RESOURCES table of the GENERA L schema.As a user of the database. This type of view is called complex view. as a FULL JOIN. What ha ppens when you execute this query? SELECT * FROM HR. Answer: B Explanation: By executing this query you will extract data from the HR table in your own sche ma. you created a table called HR in your schema. OCP Introduction to Oracle 9i: SQL Exam Guide. E: This query will not retrieve data from both tables as a FULL JOIN. D: A view can be created with a GROUP BY clause in the SELECT statement. Jason Couchman. not from the GENERAL schema. B. A view cannot be created with a GROUP BY clause in the SELECT statement. p. so long as th e ORDER BY clause appearsoutside the parentheses. The following is an example of w hat I mean: CREATE VIEW my_view AS (SELECT*FROM emp) ORDER BYempno. You obtain the results retrieved from both the public synonym HR and the HR t able that belongs to your schema. B Explanation: A view can be created as read only object. You obtain the results retrieved from both the public synonym HR and the HR t able that belongs to your schema. 292-309 Chapter 7: Creating Other Database Objects in Oracle . Comple x views provide complicated data models where many base tables are drawn togethe r into one virtual table. using synonym HR. 331-335 Chapter 7: Creating Other Database Objects in Oracle Question No:. E.

Sign up to vote on this title
UsefulNot useful