Tuesday, October 09, 2012

1Z0-007

1Z0-007
NOTE: Marked with Red are correct answers.
Questions marked with Dark Blue were asked in the paper on 04th Oct, 2004.

 

1. Which of the following queries can you use to search for employees 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 '\';

2. 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 of the employees reporting to his/her respective manager
C. it calculates, for each employee in the employees table, the average salary of the employees reporting to his/her respective manager who were hired just before the employee
D. it calculates, for each employee in the employees table, the average salary of the employees reporting to the same manager who were hired in the range just before through just after the employee
E. it calculates, for each employee in the employees table, the average salary of the employees reporting to his/her respective manager who were hired just after the employee

3. with 9i SQL Plus, What kinds of commands can you enters at the command prompt (Choose all that apply)?
A. PL/SQL blocks
B. SQL*Plus commands
C. security commands
D. SQL commands

4. to write a query that performs an outer join of tables A and B and returns all rows from B, You need to write
  1. any outer join
  2. a left outer join
  3. a cross join
  4. a right outer join
  5. an inner join

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

  1. Oracle no longer perform any checkpoint for the online datafiles in the tablespace
  2. Oracle performs a checkpoint for all online datafiles in the tablespace
  3. Oracle does not ensure that all files are written
  4. The offline files may require media recovery before you bring the tablespace online
  5. E. The offline files may require media recovery after you bring the tablespace online

6. Which of the following correctly shows the correct use of the TRUNC command on a date?
  1. SELECT TRUNC(TO_DATE(12-Feb-99,DD-MON-YY, 'YEAR')) "Date " FROM DUAL;
  2. TRUNC = TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR', "Date " FROM DUAL;
  3. SELECT TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL;
  4. date = TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL

7. To grant a system privilege with the GRANT statement, you must (Choose all that apply)?

  1. have been granted the GRANT ROLE PRIVILEGE system privilege
  2. have been granted the system privilege with the ADMIN OPTION
  3. have been granted the GRANT ANY PRIVILEGE system privilege
  4. have been granted the system privilege with the GRANT OPTION

8. Which of the following are the conditions that must be met before you can use RENAME DATAFILE with the alter tablespace command (Choose all that apply)?

  1. the datafile must be taken offline before renaming
  2. the database must be open
  3. when only a single datafile is to be renamed
  4. when only a single datafile on the same drive is to be renamed

9. Before making a tablespace read only, which of the following conditions must be met (Choose all that apply)?

  1. The tablespace must contain an active rollback segments.
  2. The tablespace must be online.
  3. The tablespace must not contain any active rollback segments.
  4. The tablespace must not be involved in an open backup.
  5. The tablespace must be involved in an open backup.

10. The MANAGE TABLESPACE system privilege allows you to perform which 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

11. Which of the following has been achieved by the following SQL codes? SELECT employee_id FROM employees WHERE commission_pct = .5 OR salary > 23000;

  1. it returns employees who have a 50% of a salary greater than $23,000:
  2. it returns employees who have a 50% commission rate or a salary greater than $23,000:
  3. runtime error
  4. it returns employees who have a 50% of a salary less than $23,000:
  5. invalid syntax
  6. it returns employees who have a 50% commission rate and a salary greater than $23,000:

12. Which of the following has been achieved by the following SQL codes? SELECT * FROM employees WHERE hire_date < TO_DATE ('01-JAN-1999', 'DD-MON-YYYY') AND salary > 3500;

  1. only those hired before 1999 and earning less than $3500 a month are returned
  2. compile time error
  3. only those hired after 1999 and earning more than $3500 a month are returned
  4. runtime error
  5. only those hired before 1999 and earning more than $3500 a month are returned

13. Which of the following SQL statements can calculate and return the absolute value of -33?

  1. SELECT ABS("-33") Absolute FROM DUAL;
  2. SELECT ABS('-33') "Absolute" FROM DUAL;
  3. SELECT ABS(-33) "Absolute" FROM DUAL;
  4. SELECT ABS(-33), Absolute FROM DUAL;

14. Which two statements about Subqueries are true? (Choose two.)

  1. A single row subquery can retrieve data from only one table.
  2. 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.
  3. 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.
  4. A single row subquery can retrieve data from more than one table.
  5. A single row subquery cannot be used in a condition where the LIKE operator is used for comparison.
  6. A multiple-row subquery cannot be used in a condition where the LIKE operator is used for comparison.
15 Examine the description of the STUDENTS table:
STD_ID                         NUMBER (4)
COURSE_ID                 VARCHAR2 (10)
START_DATE               DATE
END_DATE                   DATE
Which two aggregate functions are valid on the START_DATE column? (Choose two)

  1. SUM(start_date)
  2. AVG(start_date)
  3. COUNT(start_date)
  4. AVG(start_date, end_date)
  5. MIN(start_date)
  6. MAXIMUM(start_date)

16. Examine the structure of the EMP_DEPT_VU view:
Column Name              Type Remarks
EMPLOYEE_ID             NUMBER

From the EMPLOYEES table:
EMP_NAME                  VARCHAR2 (30)
JOB_ID                         VARCHAR2 (20)
SALARY                       NUMBER
DEPARTMENT_ID         NUMBER

From the DEPARTMENTS table:
DEPT_NAME VARCHAR2 (30)
Which SQL statement produces an error?

  1. SELECT * FROM emp_dept_vu;
  2. SELECT department_id, SUM(salary) FROM emp_dept_vu GROUP BY department_id;
  3. SELECT department_id, job_id, AVG(salary) FROM emp_dept_vu GROUP BY department_id, job_id;
  4. SELECT job_id, SUM(salary) FROM emp_dept_vu WHERE department_id IN (10,20) GROUP BY job_id HAVING SUM(salary) > 20000;
  5. None of the statements produce an error; all are valid.

17. 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 salary is more than 15000?

  1. SELECT dept_id, MIN (salary), MAX (salary) FROM employees WHERE MIN(salary) < 5000 AND MAX (salary) > 15000;
  2. SELECT dept_id, MIN (salary), MAX (salary) FROM employees WHERE MIN (salary) < 5000 AND MAX (salary) 15000 GROUP BY dept_id;
  3. SELECT dept_id, MIN(salary), MAX(salary) FROM employees HAVING MIN (salary) < 5000 AND MAX (salary)
  4. SELECT dept_id, MIN (salary), MAX (salary) FROM employees GROUP BY dept_id HAVING MIN(salary) < 5000 AND MAX (salary) > 15000
  5. SELECT dept_id, MIN (salary), MAX (salary) FROM employees GROUP BY dept_id, salary HAVING MIN (salary) < 5000 AND MAX (salary) > 15000;

18. 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.
  1. The data and structure of the EMPLOYEES table are deleted.
  2. The data in the EMPLOYEES table is deleted but not the structure.
  3. You get an error because the statement is not syntactically correct.

19. Evaluate this SQL statement:
SELECT e.employee_id, (.15* e.salary) + (.5 * e.commission_pct) + (s.sales_amount * (.35 * e.bonus)) AS CALC_VALUE FROM employees e, sales WHERE e.employee_id = s.emp_id;

What will happen if you remove all the parentheses from the calculation?

  1. The value displayed in the CALC_VALUE column will be lower.
  2. The value displayed in the CALC_VALUE column will be higher.
  3. There will be no difference in the value displayed in the CALC_VALUE column.
  4. An error will be reported.

20. 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?

  1. MERGE INTO new_employees c USING employees e ON (c.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHED THEN INSERT VALUES (e.employee_id, e.first_name ||', '||e.last_name);
  2. MERGE new_employees c USING employees e ON (c.employee_id = e.employee_id) WHEN EXISTS THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHED THEN INSERT VALUES (e.employee_id, e.first_name ||', '||e.last_name);
  3. MERGE INTO new_employees c USING employees e ON (c.employee_id = e.employee_id) WHEN EXISTS THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHED THEN INSERT VALUES(e.employee_id, e.first_name ||', '||e.last_name);
  4. MERGE new_employees c FROM employees e ON (c.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHED THEN INSERT INTO new_employees VALUES (e.employee_id, e.first_name ||', '||e.! last_name);

21 .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"?

  1. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, 'a') FROM EMPLOYEES WHERE SUBSTR(ENAME, -1, 1) = 'n';
  2. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, ,-1,1) FROM EMPLOYEES WHERE SUBSTR(ENAME, -1, 1) = 'n';
  3. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR(ENAME, 1, 1) = 'n';
  4. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR(ENAME, -1, 1) = 'n';

22. You would like to display the system date in the format "Monday, 01 June, 2001". Which SELECT statement should you use?

  1. SELECT TO_DATE (SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual;
  2. SELECT TO_CHAR (SYSDATE, 'FMDD, DY Month, YYYY') FROM dual;
  3. SELECT TO_CHAR (SYSDATE, 'FMDay, DD Month, YYYY') FROM dual;
  4. SELECT TO_CHAR (SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;
  5. SELECT TO_DATE (SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;

23. What is true about joining tables through an Equijoin?

  1. You can join a maximum of two tables through an Equijoin.
  2. You can join a maximum of two columns through an Equijoin.
  3. You specify an Equijoin condition in the SELECT or FROM clauses of a SELECT statement.
  4. To join two tables through an Equijoin, the columns in the join condition must be primary key and foreign key columns.
  5. You can join n tables (all having single column primary keys) in a SQL statement by specifying a minimum of n-1 join conditions.

24. 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

25. View the image below to examine the structures of the EMPLOYEES and TAX tables.
You need to find the percentage tax applicable for each employee. Which SQL statement would you use?

  1. SELECT employee_id, salary, tax_percent FROM employees e, tax t WHERE e.salary BETWEEN t.min_salary AND t.max_salary;
  2. SELECT employee_id, salary, tax_percent FROM employees e, tax t WHERE e.salary > t.min_salary AND < t.max_salary;
  3. SELECT employee_id, salary, tax_percent FROM employees e, tax t WHERE MIN(e.salary) = t.min_salary AND MAX(e.salary) = t.max_salary;
  4. You cannot find the information because there is no common column between the two tables.

26. Click the Exhibit button to examine the structures of the EMPLOYEES, DEPARTMENTS 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).

  1. SELECT emp_name, department_name, city FROM employees e JOIN departments d USING (department_id) JOIN locations 1 USING (location_id) WHERE salary > 10000;
  2. 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;
  3. SELECT emp_name, department_name, city FROM employees e, departments d, locations 1 WHERE salary > 1000;
  4. 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.location_id AND salary > 10000;
  5. SELECT emp_name, department_name, city FROM employees e NATURAL JOIN departments, locations WHERE salary > 10000;
Answer: AD........BD

27. Which SQL statement would you use to remove a view called EMP_DEPT_VU from your 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;

28. Which is an iSQL*Plus command?

A. INSERT
B. UPDATE
C. SELECT
D. DESCRIBE
E. DELETE
F. RENAME

29. 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?

  1. Column definitions cannot be altered to add DEFAULT values.
  2. A change to the DEFAULT value affects only subsequent insertions to the table.
  3. Column definitions cannot be altered to add DEFAULT values for columns with a NUMBER data type.
  4. All the rows that have a NULL value for the SALARY column will be updated with the value 5000.

30. 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)
Which statement produces the number of different departments that have employees with last name Smith?

  1. SELECT COUNT(*) FROM employees WHERE last_name='Smith';
  2. SELECT COUNT (dept_id) FROM employees WHERE last_name='Smith';
  3. SELECT DISTINCT(COUNT(dept_id)) FROM employees WHERE last_name='Smith';
  4. SELECT COUNT(DISTINCT dept_id) FROM employees WHERE last_name='Smith';
  5. SELECT UNIQUE(dept_id) FROM employees WHERE last_name='Smith';

31. Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?

  1. SELECT TO_CHAR(SYSDATE, 'yyyy') FROM dual;
  2. SELECT TO_DATE(SYSDATE, 'yyyy') FROM dual;
  3. SELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY') FROM dual;
  4. SELECT DECODE(SUBSTR(SYSDATE, 8), 'year') FROM dual;
  5. SELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),'yyyy') FROM dual;

32. The STUDENT_GRADES table has these columns:
STUDENT_ID                NUMBER (12)
SEMESTER_END         DATE
GPA                             NUMBER (4, 3)
Which statement finds students who have a grade point average (GPA) greater than 3.0 for the calendar year 2001?

  1. SELECT student_id, gpa FROM student_grades WHERE semester_end BETWEEN '01-JAN-2001' AND '31-DEC-2001' OR gpa > 3.0;
  2. SELECT student_id, gpa FROM student_grades WHERE semester_end BETWEEN '01-JAN-2001' AND '31-DEC-2001' AND gpa > 3.0;
  3.  SELECT student_id, gpa FROM student_grades WHERE semester_end BETWEEN '01-JAN-2001' AND '31-DEC-2001' AND gpa > 3.0;
  4. SELECT student_id, gpa FROM student_grades WHERE semester_end BETWEEN '01-JAN-2001' AND '31-DEC-2001' AND gpa >= 3.0;
  5. SELECT student_id, gpa FROM student_grades WHERE semester_end > '01-JAN-2001' OR semester_end < '31-DEC-2001' AND gpa >= 3.0;

33. Top N analysis requires _____ and _____. (Choose two.)

A. the use of rowed
B. a GROUP BY clause
C. an ORDER BY clause
D. only an inline view
E. an inline view and an outer query

34. Which are DML statements? (Choose all that apply.)

A. COMMIT
B. MERGE
C. UPDATE
D. DELETE
E. CREATE
F. DROP

35. Which three is true regarding the use of outer joins? (Choose three.)

  1. You cannot use IN operator in a condition that involves an outer join.
  2. You use (+) on both sides of the WHERE condition to perform an outer join.
  3. You use (*) on both sides of the WHERE condition to perform an outer join.
  4. You use an outer join to see only the rows that do not meet the join condition.
  5. In the WHERE condition, you use (+) following the name of the column in the table without matching rows, to perform an outer join.
  6. You cannot link a condition that is involved in an outer join to another condition by using the OR operator.

36. Which statement adds a constraint that ensures the CUSTOMER_NAME column of the CUSTOMERS table holds a value?

  1. ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name IS NOT NULL;
  2. ALTER TABLE customers MODIFY CONSTRAINT cust_name_nn CHECK customer_name IS NOT NULL;
  3. ALTER TABLE customers MODIFY customer_name CONSTRAINT cust_name_nn NOT NULL;
  4. ALTER TABLE customers MODIFY customer_name CONSTRAINT cust_name_nn IS NOT NULL;
  5. ALTER TABLE customers MODIFY name CONSTRAINT cust_name_nn NOT NULL;
  6. ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name NOT NULL;

37. Evaluate this SQL statement:
SELECT ename, sal, 12*sal+100 FROM EMP;
The SAL column stores the monthly salary of the employee. Which change must be made to the above syntax to calculate the annual compensation as "monthly salary plus a monthly bonus of $100, multiplied by 12"?

  1. No change is required to achieve the desired results.
  2. SELECT ename, sal, 12*(sal+100) FROM emp;
  3. SELECT ename, sal, (12*sal)+100 FROM emp;
  4. SELECT ename, sal+100,*12 FROM emp;

38. You are the DBA for an academic database. You need to create a role that allows a group of users to modify existing rows in the STUDENT_GRADES table.

Which set of statements accomplishes this?

A.      CREATE ROLE registrar; GRANT MODIFY ON student_grades TO registrar; GRANT registrar to user1, user2, user3
  1. CREATE NEW ROLE registrar; GRANT ALL ON student_grades TO registrar; GRANT registrar to user1, user2, user3
  2. CREATE ROLE registrar; GRANT UPDATE ON student_grades TO registrar; GRANT ROLE registrar to user1, user2, user3
  3. CREATE ROLE registrar; GRANT UPDATE ON student_grades TO registrar; GRANT registrar to user1, user2, user3;
  4. E. CREATE registrar; GRANT CHANGE ON student_grades TO registrar; GRANT registrar;

39. You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty.
Which statement accomplishes this task?

  1. ALTER TABLE students ADD PRIMARY KEY student_id;
  2. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);
  3. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;
  4. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);
  5. ALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

40. 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?

  1. SELECT student_id, gpa FROM student_grades ORDER BY gpa ASC;
  2. SELECT student_id, gpa FROM student_grades SORT ORDER BY gpa ASC;
  3. SELECT student_id, gpa FROM student_grades SORT ORDER BY gpa;
  4. SELECT student_id, gpa FROM student_grades ORDER BY gpa;
  5. SELECT student_id, gpa FROM student_grades SORT ORDER BY gpa DESC;
  6. SELECT student_id, gpa FROM student_grades ORDER BY gpa DESC;

41. Which describes the default behavior when you create a table?

  1. The table is accessible to all users.
  2. Tables are created in the public schema.
  3. Tables are created in your schema.
  4. Tables are created in the DBA schema.
  5. You must specify the schema when the table is created.

42. Which four are attributes of single row functions? (Choose four.)
  1. cannot be nested
  2. manipulate data items
  3. act on each row returned
  4. return one result per row
  5. accept only one argument and return only one value
  6. accept arguments which can be a column or an expression

43. Which statement creates a new user?

  1. CREATE USER Susan;
  2. CREATE OR REPLACE USER Susan;
  3. CREATE NEW USER Susan DEFAULT;
  4. CREATE USER Susan IDENTIFIED BY blue;
  5. CREATE NEW USER Susan IDENTIFIED by blue;
  6. CREATE OR REPLACE USER Susan IDENTIFIED BY blue;

44. You need to create a table named ORDERS that contains four columns: - an ORDER_ID column of number data type - a CUSTOMER_ID column of number data type - an ORDER_STATUS column that contains a character data type - a DATE_ORDERED column to contain the date the order was placed. When a row is inserted into the table, if no value is provided for the status of the order, the value PENDING should be used instead. Which statement accomplishes this?

  1. CREATE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8), order_status NUMBER(10) DEFAULT 'PENDING', date_ordered DATE );
  2. CREATE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8), order_status VARCHAR2(10) = 'PENDING', date_ordered DATE );
  3. CREATE OR REPLACE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8), order_status VARCHAR2(10) DEFAULT 'PENDING', date_ordered DATE );
  4. CREATE OR REPLACE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8), order_status VARCHAR2(10) = 'PENDING', date_ordered DATE );
  5. CREATE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8),order_status VARCHAR2(10) DEFAULT 'PENDING', date_ordered DATE );
  6. CREATE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8),order_status VARCHAR2(10) DEFAULT 'PENDING', date_ordered VARCHAR2 );

45. Which two statements complete a transaction? (Choose two.)

  1. DELETE employees;
  2. DESCRIBE employees;
  3. ROLLBACK TO SAVEPOINT C;
  4. GRANT SELECT ON employees TO SCOTT;
  5. ALTER TABLE employees SET UNUSED COLUMN sal;
  6. SELECT MAX(sal) FROM employees WHERE department_id = 20;

46. Examine the data from the EMP table:
EMP_ID DEPT_ID COMMISSION
1          10                     500
2          20                     1000
3                     10        
4                     10                     600
5                     30                     800
6                     30                     200
7                     10
8                     20                     300
The COMMISSION column shows the monthly commission earned by the employee. Which three tasks would require Subqueries or joins in order to perform in a single step? (Choose three)

A.      Deleting the records of employees who do not earn commission.
B.      Increasing the commission of employee 3 by the average commission earned in department 20.
C.      Finding the number of employees who do NOT earn commission and are working for department 20.
D.     Inserting into the table a new employee 10 who works for department 20 and earns a commission that is equal to the commission earned by employee 3.
E.      Creating a table called COMMISSION that has the same structure and data as the columns EMP_ID and COMMISSIONS of the EMP table.
F.      Decreasing the commission by 150 for the employees who are working in department 30 and earning a commission of more then 800.

47. View the image below and examine the data from the EMP table. Evaluate this SQL statement:
SELECT * FROM EMP WHERE commission = (SELECT commission FROM EMP WHERE emp_id = 3); what is the result when the query is executed?

  1. ===
  2. ===
  3. The query returns no rows.
  4. The query fails because the outer query is retrieving more than one column.
  5. The query fails because both the inner and outer queries are retrieving data from the same table.

48. Examine the data in the EMPLOYEES and DEPARTMENTS tables.
EMPLOYEES LAST_NAME       DEPARTMENT_ID         SALARY
Getz                                         10                                 3000
Davis                                        20                                 1500
King                                         20                                 2200
Davis                                        30                                 5000
Kochhar                                                                       5000

DEPARTMENTS
DEPARTMENT_ID         DEPARTMENT_NAME
10                                 Sales
20                                 Marketing
30                                 Accounts
40                                 Administration
You want to retrieve all employees, whether or not they have matching departments in the departments table. Which query would you use?

  1. SELECT last_name, department_name FROM employees , departments(+);
  2. SELECT last_name, department_name FROM employees JOIN departments (+);
  3. SELECT last_name, department_name FROM employees(+) e JOIN departments d ON (e.department_id = d.department_id);
  4. SELECT last_name, department_name FROM employees e RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);
  5. SELECT last_name, department_name FROM employees(+) , departments ON (e.department_id = d.department_id);
  6. SELECT last_name, department_name FROM employees e LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);

49. Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID             NUMBER                      Primary Key
FIRST_NAME               VARCHAR2 (25)
LAST_NAME                VARCHAR2 (25)
Which three statements insert a row into the table? (Choose three.)

  1. INSERT INTO employees VALUES ( NULL, 'John', 'Smith');
  2. INSERT INTO employees( first_name, last_name) VALUES( 'John', 'Smith');
  3. INSERT INTO employees VALUES ( '1000', 'John', NULL);
  4. INSERT INTO employees (first_name, last_name, employee_id) VALUES ( 1000, 'John', 'Smith');
  5. INSERT INTO employees (employee_id) VALUES (1000);
  6. INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, 'John', ‘ ');

50. Evaluate these two SQL statements:
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC; SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC;
What is true about them?

  1. The two statements produce identical results.
  2. The second statement returns a syntax error.
  3. There is no need to specify DESC because the results are sorted in descending order by default.
  4. The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement.

51. Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID                         NUMBER                      Primary Key
FIRST_NAME                           VARCHAR2 (25)
LAST_NAME                            VARCHAR2 (25)
HIRE_DATE                              DATE
Which UPDATE statement is valid?

  1. UPDATE employees SET first_name = 'John' SET last_name='Smith' WHERE employee_id = 180;
  2. UPDATE employees SET first_name = 'John', SET last_name ='Smith' WHERE employee_id = 180;
  3. UPDATE employees SET first_name = 'John' AND last_name ='Smith' WHERE employee_id = 180;
  4. UPDATE employees SET first_name = 'John', last_name ='Smith' WHERE employee_id = 180;

52. Evaluate the SQL statement DROP TABLE DEPT;
Which four statements are true of the SQL statement? (Choose four.)

A.      You cannot roll back this statement.
  1. All pending transactions are committed.
  2. All views based on the DEPT table are deleted.
  3. All indexes based on the DEPT table are dropped.
  4. All data in the table is deleted, and the table structure is also deleted.
  5. All data in the table is deleted, but the structure of the table is retained.
  6. All synonyms based on the DEPT table are deleted.

53. The user Sue issues this SQL statement: GRANT SELECT ON sue.EMP TO Alice WITH GRANT OPTION; The user Alice issues this SQL statement: GRANT SELECT ON sue.EMP TO Rena WITH GRANT OPTION; The user Rena issues this SQL statement: GRANT SELECT ON sue.EMP TO timber; The user Sue issues this SQL statement: REVOKE select on sue.EMP FROM Alice; For which users does the revoke command revoke SELECT privileges on the SUE.EMP table?

A. Alice only
B. Alice and Rena
C. Alice, Rena, and Timber
D. Sue, Alice, Rena, and Timber

54. The EMPLOYEES table contains these columns:
EMPLOYEE_ID             NUMBER (4)
LAST_NAME                VARCHAR2 (25)
JOB_ID                         VARCHAR2 (10)
You want to search for strings that contain 'SA_' in the JOB_ID column. Which SQL statement do you use?

  1. SELECT employee_id, last_name, job_id FROM employees WHERE job_id LIKE '%SA\_%' ESCAPE '\';
  2.  SELECT employee_id, last_name, job_id FROM employees WHERE job_id LIKE '%SA_';
  3. SELECT employee_id, last_name, job_id FROM employees WHERE job_id LIKE '%SA_' ESCAPE "\";
  4. SELECT employee_id, last_name, job_id FROM employees WHERE job_id = '%SA_';

55. Examine the structure of the EMPLOYEES table:
Column name              Data type                      Remarks
EMPLOYEE_ID             NUMBER                      NOT NULL,       Primary Key
LAST_NAME                VARCHAR2 (30)           
FIRST_NAME               VARCHAR2 (30)
JOB_ID                         NUMBER
SAL                              NUMBER
MGR_ID                        NUMBER
References EMPLOYEE_ID column DEPARTMENT_ID NUMBER
You need to create an index called NAME_IDX on the first name and last name fields of the EMPLOYEES table. Which SQL statement would you use to perform this task?

  1. CREATE INDEX NAME_IDX (first_name, last_name);
  2. CREATE INDEX NAME_IDX (first_name AND last_name);
  3. CREATE INDEX NAME_IDX ON (first_name, last_name);
  4. CREATE INDEX NAME_IDX ON employees (first_name AND last_name);
  5. CREATE INDEX NAME_IDX ON employees(first_name, last_name);
  6. CREATE INDEX NAME_IDX FOR employees(first_name, last_name);

56. The CUSTOMERS table has these columns:
CUSTOMER_ID                         NUMBER (4)                 NOT NULL
CUSTOMER_NAME                  VARCHAR2 (100)          NOT NULL
CUSTOMER_ADDRESS            VARCHAR2 (150)
CUSTOMER_PHONE                VARCHAR2 (20)
You need to produce output that states "Dear Customer customer_name”. The customer_name data values come from the CUSTOMER_NAME column in the CUSTOMERS table. Which statement produces this output?

  1. SELECT dear customer, customer_name, FROM customers;
  2. SELECT "Dear Customer", customer_name || ',' FROM customers;
  3. SELECT 'Dear Customer ' || customer_name ',' FROM customers;
  4. SELECT 'Dear Customer ' || customer_name || ',' FROM customers;
  5. SELECT "Dear Customer " || customer_name || "," FROM customers;
  6. SELECT 'Dear Customer ' || customer_name || ',' || FROM customers;

57. What is true about sequences?

  1. Once created, a sequence belongs to a specific schema.
  2. Once created, a sequence is linked to a specific table.
  3. Once created, a sequence is automatically available to all users.
  4. Only the DBA can control which sequence is used by a certain table.
  5. Once created, a sequence is automatically used in all INSERT and UPDATE statements.

58. Which statement describes the ROWID data type?

  1. binary data up to 4 gigabytes
  2. character data up to 4 gigabytes
  3. raw binary data of variable length up to 2 gigabytes
  4. binary data stored in an external file, up to 4 gigabytes
  5. a hexadecimal string representing the unique address of a row in its table

59. Which object privileges can be granted on a view?

A. none
B. DELETE, INSERT, SELECT
C. ALTER, DELETE, INSERT, SELECT
D. DELETE, INSERT, SELECT, UPDATE

60. Examine the SQL statement that creates ORDERS table:
CREATE TABLE orders (SER_NO NUMBER UNIQUE, ORDER_ID NUMBER, ORDER_DATE DATE NOT NULL, STATUS VARCHAR2 (10) CHECK (status IN ('CREDIT', 'CASH')), PROD_ID NUMBER REFERENCES PRODUCTS (PRODUCT_ID), ORD_TOTAL NUMBER, PRIMARY KEY (order_id, order_date));
For which columns would an index be automatically created when you execute the above SQL statement? (Choose two.)

  1. SER_NO
  2. ORDER_ID
  3. STATUS
  4. PROD_ID
  5. ORD_TOTAL
  6. composite index on ORDER_ID and ORDER_DATE

61. What is true of using group functions on columns that contain NULL values?

  1. Group functions on columns ignore NULL values.
  2. Group functions on columns returning dates include NULL values.
  3. Group functions on columns returning numbers include NULL values.
  4. Group functions on columns cannot be accurately used on columns that contain NULL values.
  5. Group functions on columns include NULL values in calculations if you use the keyword INC_NULLS.

62. The STUDENT_GRADES table has these columns:
STUDENT_ID                NUMBER (12)
SEMESTER_END         DATE
GPA                             NUMBER (4, 3)
Which statement finds the highest grade point average (GPA) per semester?

  1. SELECT MAX(gpa) FROM student_grades WHERE gpa IS NOT NULL;
  2. SELECT (gpa) FROM student_grades GROUP BY semester_end WHERE gpa IS NOT NULL;
  3. SELECT MAX(gpa) FROM student_grades WHERE gpa IS NOT NULL GROUP BY semester_end;
  4. SELECT MAX(gpa) GROUP BY semester_end WHERE gpa IS NOT NULL FROM student_grades;
  5. SELECT MAX(gpa) FROM student_grades GROUP BY semester_end WHERE gpa IS NOT NULL;
63. In which four clauses can a subquery be used? (Choose four.)

  1. in the INTO clause of an INSERT statement
  2. in the FROM clause of a SELECT statement
  3. in the GROUP BY clause of a SELECT statement
  4. in the WHERE clause of a SELECT statement
  5. in the SET clause of an UPDATE statement
  6. in the VALUES clause of an INSERT statement
64. Examine this statement:
SELECT student_id, GPA FROM student_grades WHERE GPA > &&value;
You run the statement once, and when prompted you enter a value of 2.0. A report is produced. What happens when you run the statement a second time?

  1. An error is returned.
  2. You are prompted to enter a new value.
  3. A report is produced that matches the first report produced.
  4. You are asked whether you want a new value or if you want to run the report based on the previous value.

65. Which SQL statement returns a numeric value?

  1. SELECT ADD_MONTHS(MAX (hire_date), 6) FROM EMP;
  2. SELECT ROUND(hire_date)FROM EMP;
  3. SELECT sysdate-hire_date FROM EMP;
  4. SELECT TO_NUMBER(hire_date + 7)FROM EMP;

66. What are two reasons to create synonyms? (Choose two.)

  1. You have too many tables.
  2. Your tables are too long.
  3. Your tables have difficult names.
  4. You want to work on your own tables.
  5. You want to use another schema's tables.
  6. You have too many columns in your tables.

67. Examine the data of the EMPLOYEES table.
EMPLOYEES (EMPLOYEE_ID is the primary key.
MGR_ID is the ID of managers and refers to the EMPLOYEE_ID)

EMPLOYEE_ID EMP_NAME     DEPT_ID          MGR_ID            JOB_ID             SALARY

101                   Smith                20                     120                   SA_REP           4000
102                   Martin               10                     105                   CLERK             2500
103                   Chris                 20                     120                   IT_ADMIN         4200
104                   John                 30                     108                   HR_CLERK       2500
105                   Diana                30                     108                   HR_MGR          5000
106                   Bryan                40                     110                   AD_ASST         3000
108                   Jennifer            30                     110                   HR_DIR            6500
110                   Bob                  40                                             EX_DIR            8000
120                   Ravi                  20                     110                   SA_DIR            6500

Evaluate this SQL statement:

SELECT e.employee_id "Emp_id", e.emp_name "Employee", e.salary, m.employee_id "Mgr_id", m.emp_name "Manager" FROM employees e, employees m WHERE e.mgr_id = m.employee_id AND e.salary > 4000;
What is its output?

A.      Emp_id             EMPLOYEE      SALARY           Mgr_id Manager
---- ---------                -------------           ----------------        -------------
110                   Bob                  8000                 Bob
120                   Ravi                  6500                
110                   Ravi
108                   Jennifer            6500
110                   Jennifer
103                   Chris                 4200
120                   Chris                
105                   Diana                5000
108                   Diana
B. Emp_id              EMPLOYEE      SALARY           Mgr_id Manager
-------                 -------------           -----------------       ------------------
120                   Ravi                  6500
110                   Bob                 
108                   Jennifer            6500
110                   Bob
103                   Chris                 4200
120                   Ravi
105                   Diana                5000
108                   Jennifer
C. Emp_id              EMPLOYEE      SALARY           Mgr_id Manager
-------                 ---------- ---------               -------------
110                   Bob                  8000
120                   Ravi                  6500
110                   Bob     
108                   Jennifer            6500
110                   Bob
103                   Chris                 4200
120                   Ravi                 
105                   Diana                5000
108                   Jennifer
D. Emp_id                    EMPLOYEE      SALARY           Mgr_id Manager
-------                             ---------- ---------               --------------
110                               Bob                  8000
110                               Bob     
120                               Ravi                  6500
120                               Ravi     
108                               Jennifer            6500
108                               Jennifer           
103                               Chris                 4200
103                               Chris
105                               Diana                5000
105                               Dina

E. the SQL statement produces an error.

68. What is true about updates through a view?

  1. You cannot update a view with group functions.
  2. When you update a view group functions are automatically computed.
  3. When you update a view only the constraints on the underlying table will be in effect.
  4. When you update a view the constraints on the views always override the constraints on the underlying tables.

69. You need to write a SQL statement that returns employee name, salary, department ID, and maximum salary earned in the department of the employee for all employees who earn less than the maximum salary in their department.
Which statement accomplishes this task?

A.      SELECT a.emp_name, a.sal, b.dept_id, MAX(sal) FROM employees a, departments b WHERE a.dept_id = b.dept_id AND a.sal < MAX(sal) GROUP BY b.dept_id;
  1. SELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a, (SELECT dept_id, MAX(sal) maxsal FROM employees GROUP BY dept_id) b WHERE a.dept_id = b.dept_id AND a.sal < b.maxsal;
  2. SELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a WHERE a.sal < (SELECT MAX(sal) maxsal FROM employees b GROUP BY dept_id);
  3. SELECT emp_name, sal, dept_id, maxsal FROM employees, (SELECT dept_id, MAX(sal) maxsal FROM employees GROUP BY dept_id) WHERE a.sal < maxsal;

Answer: B

70. View the image below and examine the data from the ORDERS and CUSTOMERS tables. Evaluate this SQL statement:
SELECT cust_id, ord_total FROM orders WHERE ord_total > ANY(SELECT ord_total FROM orders WHERE cust_id IN (SELECT cust_id FROM customers WHERE city LIKE 'New York'));
What is the result when the above query is executed?

A. **

B. **

C. **

D. **

E.                  The query returns no rows.
F.                  The query fails because ANY is not a valid operator with a subquery.

71.  Mark for review You need to create a table named ORDERS that contains four columns: - an ORDER_ID column of number data type - a CUSTOMER_ID column of number data type - an ORDER_STATUS column that contains a character data type - a DATE_ORDERED column to contain the date the order was placed. When a row is inserted into the table, if no value is provided when the order was placed, today's date should be used instead.
Which statement accomplishes this?

A.      CREATE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8),order_status VARCHAR2 (10),date_ordered DATE = SYSDATE);
B.      CREATE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8),order_status VARCHAR2 (10),date_ordered DATE DEFAULT SYSDATE);
C.      CREATE OR REPLACE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8),order_status VARCHAR2 (10),date_ordered DATE DEFAULT SYSDATE);
D.     CREATE OR REPLACE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8),order_status VARCHAR2 (10),date_ordered DATE = SYSDATE);
E.      CREATE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8),order_status NUMBER (10),date_ordered DATE = SYSDATE);
F.      CREATE TABLE orders (order_id NUMBER(10), customer_id NUMBER(8),order_status NUMBER (10),date_ordered DATE DEFAULT SYSDATE);

72. Mark for review Evaluate the SQL statement:
SELECT ROUND (45.953, -1), TRUNC (45.936, 2) FROM dual;
Which values are displayed?

  1. 46 and 45
  2. 46 and 45.93
  3. 50 and 45.93
  4. 50 and 45.9
  5. 45 and 45.93
  6. 45.95 and 45.93

73. Mark for review. 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)
A promotional sale is being advertised to the customers in France. Which WHERE clause identifies customers that are located in France?

  1. WHERE lower(country_address) = "France"
  2. WHERE lower(country_address) = 'france'
  3. WHERE lower(country_address) IS 'France'
  4. WHERE lower(country_address) = '%France%'
  5. WHERE lower(country_address) LIKE %France%

74. Mark for review Examine the description of the CUSTOMERS table:
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.

 Which statement returns the city address and the number of customers in the cities Los Angeles or San Francisco?

  1. SELECT city_address, COUNT(*) FROM customers WHERE city_address IN ('Los Angeles', 'San Francisco');
  2. SELECT city_address, COUNT(*) FROM customers WHERE city_address IN ('Los Angeles', 'San Francisco') GROUP BY city_address;
  3.  SELECT city_address, COUNT(customer_id) FROM customers WHERE city_address IN ('Los Angeles', 'San Francisco') GROUP BY city_address, customer_id;
  4. SELECT city_address, COUNT(customer_id) FROM customers GROUP BY city_address IN ('Los Angeles', 'San Francisco');

75. Mark for review what does the FORCE option for creating a view do?

  1. creates a view with constraints
  2. creates a view even if the underlying parent table has constraints
  3. creates a view in another schema even if you don't have privileges
  4. creates a view regardless of whether or not the base tables exist

76. Mark for review 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 finds the number of different countries represented in the CUSTOMERS table?

A.      COUNT(UPPER(country_address))
  1. COUNT(DIFF(UPPER(country_address)))
  2. COUNT(UNIQUE(UPPER(country_address)))
  3. COUNT DISTINCT UPPER(country_address)
  4. COUNT(DISTINCT (UPPER(country_address)))

77. Mark for review a data manipulation language statement _____.

  1. completes a transaction on a table
  2. modifies the structure and data in a table
  3. modifies the data but not the structure of a table
  4. modifies the structure but not the data of a table

78. Mark for review which two tasks can you perform using only the TO_CHAR function? (Choose two.)

  1. convert 10 to 'TEN'
  2. convert '10' to 10
  3. convert 10 to '10'
  4. convert 'TEN' to 10
  5. convert a date to a character expression
  6. convert a character expression to a date

79. Mark for review The DBA issues this SQL command: CREATE USER Scott IDENTIFIED by tiger; what privileges do the user Scott has at this point?

  1. no privileges
  2. only the SELECT privilege
  3. only the CONNECT privilege
  4. all the privileges of a default user

80. Mark for review View the image below and examine the data in the EMPLOYEES table.
Examine the subquery:
SELECT last_name FROM employees WHERE salary IN (SELECT MAX (salary) FROM employees GROUP BY department_id);
Which statement is true?

A.      The SELECT statement is syntactically accurate.
B.      The SELECT statement does not work because there is no HAVING clause.
C.      The SELECT statement does not work because the column specified in the GROUP BY clause is not in the SELECT list.
D.     The SELECT statement does not work because the GROUP BY clause should be in the main query and not in the subquery.

81. Mark for review you need to produce a report for mailing labels for all customers. The mailing label must have only the customer name and address. The CUSTOMERS table has these columns:
CUST_ID                      NUMBER (4)                 NOT NULL
CUST_NAME                VARCHAR2 (100)          NOT NULL
CUST_ADDRESS          VARCHAR2 (150)
CUST_PHONE              VARCHAR2 (20)
Which SELECT statement accomplishes this task?

  1. SELECT *FROM customers;
  2. SELECT name, address FROM customers;
  3. SELECT id, name, address, phone FROM customers;
  4. SELECT cust_name, cust_address FROM customers;
  5. SELECT cust_id, cust_name, cust_address, cust_phone FROM customers;

82. Mark for review Examine the statement:
GRANT select, insert, update ON student_grades TO manager WITH GRANT OPTION; which two are true? (Choose two.)

  1. MANAGER must be a role.
  2. It allows the MANAGER to pass the specified privileges on to other users.
  3. It allows the MANAGER to create tables that refer to the STUDENT_GRADES table.
  4. It allows the MANAGER to apply all DML statements on the STUDENT_GRADES table.
  5. It allows the MANAGER the ability to select from, insert into, and update the STUDENT_GRADES table.
  6. It allows the MANAGER the ability to select from, delete from, and update the STUDENT_GRADES table.

83. Mark for review which best describes an inline view?

  1. a schema object
  2. a subquery that can contain an ORDER BY clause
  3. another name for a view that contains group functions
  4. a subquery that is part of the FROM clause of another query

84. Mark for review. Examine the structure of the EMPLOYEES and DEPARTMENTS tables:
EMPLOYEES
EMPLOYEE_ID             NUMBER
DEPARTMENT_ID         NUMBER
MANAGER_ID               NUMBER
LAST_NAME                VARCHAR2 (25)

DEPARTMENTS
DEPARTMENT_ID         NUMBER
MANAGER_ID               NUMBER
DEPARTMENT_NAME VARCHAR2 (35)
LOCATION_ID              NUMBER

You want to create a report displaying employee last names, department names, and locations. Which query should you use to create an Equijoin?

A.      SELECT last_name, department_name, location_id FROM employees , departments ;
B.      SELECT employees.last_name, departments.department_name, departments.location_id FROM employees e, departments D WHERE e.department_id =d.department_id;
C.      SELECT e.last_name, d.DEPARTMENT_NAME, d.location_id FROM employees e, departments D WHERE manager_id =manager_id;
D.     SELECT e.last_name, d.DEPARTMENT_NAME, d.location_id FROM employees e, departments D WHERE e.department_id =d.department_id;

85. Mark for review The PRODUCTS table has these columns:
PRODUCT_ID               NUMBER (4)
PRODUCT_NAME         VARCHAR2 (45)
PRICE                          NUMBER (8, 2)
Evaluate this SQL statement:
SELECT * FROM PRODUCTS ORDER BY price, product_name;
What is true about the SQL statement?

  1. The results are not sorted.
  2. The results are sorted numerically.
  3. The results are sorted alphabetically.
  4. The results are sorted numerically and then alphabetically.

86. Examine the data in the EMPLOYEES table:

LAST_NAME    DEPARTMENT_ID         SALARY

Getz                 10                                 3000
Davis                20                                 1500
King                 20                                 2200
Davis                30                                 5000

Which three Subqueries work? (Choose three)

  1. SELECT * FROM employees where salary > (SELECT MIN(salary) FROM employees GROUP BY department_id);
  2. SELECT * FROM employees WHERE salary = (SELECT AVG(salary) FROM employees GROUP BY department_id);
  3. SELECT distinct department_id FROM employees Where salary > ANY (SELECT AVG(salary) FROM employees GROUP BY department_id);
  4. SELECT department_id FROM employees WHERE SALARY > ALL (SELECT AVG(salary) FROM employees GROUP BY department_id);
  5. SELECT last_name FROM employees Where salary > ANY (SELECT MAX(salary) FROM employees GROUP BY department_id);
  6. SELECT department_id FROM employees WHERE salary > ALL (SELECT AVG(salary) FROM employees GROUP BY AVG(SALARY));

87. Mark for review. In which two cases would you use an outer join? (Choose two.)

  1. The tables being joined have NOT NULL columns.
  2. The tables being joined have only matched data.
  3. The columns being joined have NULL values.
  4. The tables being joined have only unmatched data.
  5. The tables being joined have both matched and unmatched data.
  6. Only when the tables have a primary key/foreign key relationship.

88. Mark for review. In which case would you use a FULL OUTER JOIN?

  1. Both tables have NULL values.
  2. You want all unmatched data from one table.
  3. You want all matched data from both tables.
  4. You want all unmatched data from both tables.
  5. One of the tables has more data than the other.
  6. You want all matched and unmatched data from only one table.

89. Mark for review. Which constraint can be defined only at the column level?

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

90. Mark for review. Examine the structure of the EMPLOYEES table:

EMPLOYEE_ID             NUMBER                      Primary Key
FIRST_NAME                VARCHAR2 (25)
LAST_NAME                 VARCHAR2 (25)
HIRE_DATE                  DATE

You issue these statements:
CREATE table new_emp (employee_id NUMBER, name VARCHAR2 (30));

INSERT INTO new_emp SELECT employee_id , last_name from employees;
Savepoint s1;
UPDATE new_emp set name = UPPER (name);
Savepoint s2;
Delete from new_emp;
Rollback to s2;
Delete from new_emp where employee_id =180;
UPDATE new_emp set name = 'James';
Rollback to s2;
UPDATE new_emp set name = 'James' WHERE employee_id =180;
Rollback;

At the end of this transaction, what is true?


  1. You have no rows in the table.
  2. You have an employee with the name of James.
  3. You cannot roll back to the same Savepoint more than once.
  4. Your last update fails to update any rows because employee ID 180 was already deleted.

91. Mark for review Which SQL statement generates the alias Annual Salary for the calculated column SALARY*12?

  1. SELECT ename, salary*12 'Annual Salary' FROM employees;
  2. SELECT ename, salary*12 "Annual Salary" FROM employees;
  3. SELECT ename, salary*12 AS Annual Salary FROM employees;
  4. SELECT ename, salary*12 AS INITCAP("ANNUAL SALARY") FROM employees

92. Mark for review View the image below and examine the data in the EMPLOYEES and DEPARTMENTS tables.

On the EMPLOYEES table,
EMPLOYEE_ID is the primary key.
MGR_ID is the ID of managers and refers to the EMPLOYEE_ID.

On the DEPARTMENTS table,
DEPARTMENT_ID is the primary key.

Evaluate this UPDATE statement:

UPDATE employees SET mgr_id = (SELECT mgr_id FROM employees WHERE dept_id = (SELECT department_id FROM departments WHERE department_name = 'Administration') ), Salary = (SELECT salary FROM employees WHERE emp_name = 'Smith') WHERE job_id = 'IT_ADMIN';

What happens when the statement is executed?


  1. The statement executes successfully, leaves the manager ID as the existing value, and changes the salary to 4000 for the employees with ID 103 and 105.
  2. The statement executes successfully, changes the manager ID to NULL, and changes the salary to 4000 for the employees with ID 103 and 105.
  3. The statement executes successfully, changes the manager ID to NULL, and changes the salary to 3000 for the employees with ID 103 and 105.
  4. The statement fails because there is more than one row matching the employee name Smith.
  5. The statement fails because there is more than one row matching the IT_ADMIN job ID in the EMPLOYEES table.
  6. The statement fails because there is no 'Administration' department in the DEPARTMENTS table

93. Mark for review. Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID             NUMBER                      NOT NULL
EMP_NAME                  VARCHAR2 (30)
JOB_ID                         VARCHAR2 (20)
SAL                              NUMBER
MGR_ID                        NUMBER
DEPARTMENT_ID         NUMBER

You want to create a SQL script file that contains an INSERT statement. When the script is run, the INSERT statement should insert a row with the specified values into the EMPLOYEES table. The INSERT statement should pass values to the table columns as specified below:

EMPLOYEE_ID: Next value from the sequence
EMP_ID_SEQEMP_NAME and JOB_ID: As specified by the user during run time, through substitution variables
SAL: 2000 MGR_ID: No value
DEPARTMENT_ID: Supplied by the user during run time through substitution variable.
The INSERT statement should fail if the user supplies a value other than 20 or 50.

Which INSERT statement meets the above requirements?


  1. INSERT INTO employees VALUES (emp_id_seq. NEXTVAL, '&ename', '&job_Id', 2000, NULL, &did);
  2. INSERT INTO employees VALUES (emp_id_seq. NEXTVAL, '&ename', '&job_Id', 2000, NULL, &did IN (20,50));
  3. INSERT INTO (SELECT * FROM employees WHERE department_id IN (20,50)) VALUES (emp_id_seq. NEXTVAL, '&ename', '&job_id', 2000, NULL, &did);
  4. INSERT INTO (SELECT * FROM employees WHERE department_id IN (20,50) WITH CHECK OPTION)VALUES (emp_id_seq. NEXTVAL, '&ename', '&job_id', 2000, NULL, &did);
  5.  NSERT INTO (SELECT * FROM employees WHERE (department_id = 20 AND department_id = 50) WITH CHECK OPTION )VALUES (emp_id_seq. NEXTVAL, '&ename', '&job_id', 2000, NULL, &did);

94. Mark for review. The user Alice wants to grant all users query privileges on her DEPT table. Which SQL statement accomplishes this?

  1. GRANT select ON dept TO ALL_USERS;
  2. GRANT select ON dept TO ALL;
  3. GRANT QUERY ON dept TO ALL_USERS
  4. GRANT select ON dept TO PUBLIC;

95. Mark for review. Which view should a user query to display the columns associated with the constraints on a table owned by the user?

A. USER_CONSTRAINTS
B. USER_OBJECTS
C. ALL_CONSTRAINTS
D. USER_CONS_COLUMNS
E. USER_COLUMNS

96. Mark for review. Which two statements are true about WHERE and HAVING clauses? (Choose two.)

  1. A WHERE clause can be used to restrict both rows and groups.
  2. A WHERE clause can be used to restrict rows only.
  3. A HAVING clause can be used to restrict both rows and groups.
  4. A HAVING clause can be used to restrict groups only.
  5. A WHERE clause CANNOT be used in a query if the query uses a HAVING clause.
  6. A HAVING clause CANNOT be used in Subqueries.

97. Mark for review. The EMP table contains these columns:
LAST_NAME                VARCHAR2 (25)
SALARY                       NUMBER (6, 2)
DEPARTMENT_ID         NUMBER (6)
You need to display the employees who have not been assigned to any department. You write the SELECT statement:
SELECT LAST_NAME, SALARY, DEPARTMENT_ID FROM EMP WHERE DEPARTMENT_ID = NULL;
What is true about this SQL statement?

  1. The SQL statement displays the desired results.
  2. The column in the WHERE clause should be changed to display the desired results.
  3. The operator in the WHERE clause should be changed to display the desired results.
  4. The WHERE clause should be changed to use an outer join to display the desired results.

98. Mark for review Examine these statements:
CREATE ROLE registrar;
GRANT UPDATE ON student_grades TO registrar;
GRANT registrar to user1, user2, user3;

What does this set of SQL statements do?



  1. The set of statements contains an error and does not work.
  2. It creates a role called REGISTRAR, adds the MODIFY privilege on the STUDENT_GRADES object to the role, and gives the REGISTRAR role to three users.
  3. It creates a role called REGISTRAR, adds the UPDATE privilege on the STUDENT_GRADES object to the role, and gives the REGISTRAR role to three users.
  4. It creates a role called REGISTRAR, adds the UPDATE privilege on the STUDENT_GRADES object to the role, and creates three users with the role.
  5. It creates a role called REGISTRAR, adds the UPDATE privilege on three users, and gives the REGISTRAR role to the STUDENT_GRADES object.
  6. It creates a role called STUDENT_GRADES, adds the UPDATE privilege on three users, and gives the UPDATE role to the registrar.

99. Mark for review. You need to design a student registration database that contains several tables storing academic information.

The STUDENTS table stores information about a student. The STUDENT_GRADES table stores information about the student's grades. Both of the tables have a column named STUDENT_ID. The STUDENT_ID column in the STUDENTS table is a primary key.

You need to create a foreign key on the STUDENT_ID column of the STUDENT_GRADES table that points to the STUDENT_ID column of the STUDENTS table. Which statement creates the foreign key?

A.      CREATE TABLE student_grades (student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), CONSTRAINT student_id_fk REFERENCES (student_id) FOREIGN KEY students(student_id));
  1. CREATE TABLE student_grades(student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), student_id_fk FOREIGN KEY (student_id) REFERENCES students(student_id));
  2. CREATE TABLE student_grades(student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), CONSTRAINT FOREIGN KEY (student_id) REFERENCES students(student_id));
  3. CREATE TABLE student_grades(student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), CONSTRAINT student_id_fk FOREIGN KEY (student_id) REFERENCES students(student_id));

100. Mark for review. Evaluate the SQL statement:
TRUNCATE TABLE DEPT;
Which three are true about the SQL statement? (Choose three.)

  1. It releases the storage space used by the table.
  2. It does not release the storage space used by the table.
  3. You can roll back the deletion of rows after the statement executes.
  4. You can NOT rollback the deletion of rows after the statement executes.
  5. An attempt to use DESCRIBE on the DEPT table after the TRUNCATE statement executes will display an error.
  6. You must be the owner of the table or have DELETE ANY TABLE system privileges to truncate the DEPT table

101. Evaluate the SQL statement DROP TABLE DEPT: Which four statements are true of the SQL statement? (Choose four)

  1. You cannot roll back this statement.
  2. All pending transactions are committed.
  3. All views based on the DEPT table are deleted.
  4. All indexes based on the DEPT table are dropped.
  5. All data in the table is deleted, and the table structure is also deleted.
  6. All data in the table is deleted, but the structure of the table is retained.
  7. All synonyms based on the DEPT table are deleted.

102. Mark for review. You need to create a view EMP_VU. The view should allow the users to manipulate the records of only the employees that are working for departments 10 or 20. Which SQL statement would you use to create the view EMP_VU?

A.      CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20);
B.      CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) WITH READ ONLY;
  1. CREATE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) WITH CHECK OPTION;
  2. CREATE FORCE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20);]
  3. CREATE FORCE VIEW emp_vu AS SELECT * FROM employees WHERE department_id IN (10,20) NO UPDATE;

103. Mark for review View the image below and examine the data from the EMP table.
The COMMISSION column shows the monthly commission earned by the employee. Which two tasks would require Subqueries or joins in order to be performed in a single step? (Choose two.) (Select all that apply)

  1. listing the employees who earn the same amount of commission as employee 3
  2. finding the total commission earned by the employees in department 10
  3. finding the number of employees who earn a commission that is higher than the average commission of the company
  4. listing the departments whose average commission is more than 600 E. listing the employees who do not earn commission and who are working for department 20 in descending order of the employee ID
  5. listing the employees whose annual commission is more than 6000

104. Mark for review. Which two statements are true about constraints? (Choose two.)

  1. The UNIQUE constraint does not permit a null value for the column.
  2. A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints.
  3. The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index.
  4. The NOT NULL constraint ensures that null values are not permitted for the column.

105. Mark for review Examine the statement:
Create synonym EMP for hr.employees;
What happens when you issue the statement?

A.      An error is generated.
  1. You will have two identical tables in the HR schema with different names.
  2. You create a table called employees in the HR schema based on your EMP table.
  3. You create an alternative name for the employees table in the HR schema in your own schema

106. You need to change the definition of an existing table. The COMMERCIALS table needs its DESCRIPTION column changed to hold varying length characters up to 2000 bytes. The column can currently hold 1000 bytes per value. The table contains 20000 rows. Which statement is valid?
  1. ALTER TABLE commercials MODIFY (description CHAR2(2000));
  2. B. ALTER TABLE commercials CHANGE (description CHAR2(2000));
  3. C. ALTER TABLE commercials CHANGE (description VARCHAR2(2000));
  4. D. ALTER TABLE commercials MODIFY (description VARCHAR2(2000));
  5. E. You cannot increase the size of a column if the table has rows.

107. Mark for review Which SQL statement accepts user input for the columns to be displayed, the table name, and the WHERE condition?

  1. SELECT &1, "&2"FROM &3 WHERE last_name = '&4';
  2. SELECT &1, '&2' FROM &3 WHERE '&last_name = '&4'';
  3. SELECT &1, &2 FROM &3 WHERE last_name = '&4';
  4. SELECT &1, '&2' FROM EMP WHERE last_name = '&4';

108. Mark for review The STUDENT_GRADES table has these columns:
STUDENT_ID                NUMBER (12)
SEMESTER_END         DATE
GPA                             NUMBER (4, 3)
The registrar has requested a report listing the students' grade point averages (GPA), sorted from highest grade point average to lowest within each semester, starting from the earliest date. Which statement accomplishes this?

  1. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end DESC, gpa DESC;
  2. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end ASC, gpa ASC;
  3. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY semester_end, gpa DESC;
  4. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY gpa DESC, semester_end DESC;
  5. SELECT student_id, semester_end, gpa FROM student_grades ORDER BY gpa DESC, semester_end ASC;

109. Mark for review 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 DELETE statement is valid?

  1. DELETE FROM employees WHERE employee_id = (SELECT employee_id FROM employees);
  2. DELETE * FROM employees WHERE employee_id = (SELECT employee_id FROM new_employees);
  3. DELETE FROM employees WHERE employee_id IN (SELECT employee_id FROM new_employees WHERE name ='Carrey');
  4. DELETE * FROM employees WHERE employee_id IN (SELECT employee_id FROM new_employees WHERE last_name ='Carrey');

110. Mark for review. Which three are true? (Choose three.)

  1. A MERGE statement is used to merge the data of one table with data from another.
  2. A MERGE statement replaces the data of one table with that of another.
  3. A MERGE statement can be used to insert new rows into a table.
  4. A MERGE statement can be used to update existing rows in a table.

111. Mark for review. Which is a valid CREATE TABLE statement?

  1. CREATE TABLE EMP9$# AS (emp_id number(2));
  2. CREATE TABLE EMP*123 AS (emp_id number(2));
  3. CREATE TABLE PACKAGE AS (pack_id number(2));
  4. CREATE TABLE 1EMP_TEST AS (emp_id number(2));

112. Mark for review A SELECT statement can be used to perform these three functions: - Choose rows from a table. - Choose columns from a table. - Bring together data that is stored in different tables by creating a link between them. Which set of keywords describes these capabilities?

  1. difference, projection, join
  2. selection, projection, join
  3. selection, intersection, join
  4. intersection, projection, join
  5. difference, projection, product

113. Evaluate this SQL statement:
SELECT e.EMPLOYEE_ID, e.LAST_NAME, e.DEPARTMENT_ID, d.DEPARTMENT_NAME FROM EMP e, DEPARTMENT d WHERE e.DEPARTMENT_ID = d.DEPARTMENT_ID;

In the statement, which capabilities of a SELECT statement are performed?


  1. Selection, projection, join
  2. Difference, projection, join
  3. Selection, intersection, join
  4. Intersection, projection, join
  5. Difference, projection, product

114. Mark for review. Which four are types of functions available in SQL? (Choose 4)

A. string
B. character
C. integer
D. calendar
E. numeric
F. translation
G. date
H. conversion

115. Mark for review View the image below and examine the data in the EMPLOYEES and DEPARTMENTS tables.
You want to retrieve all employees' last names, along with their managers' last names and their department names. Which query would you use?

A.      SELECT last_name, manager_id, department_name FROM employees e FULL OUTER JOIN departments d ON (e.department_id = d.department_id);
  1. SELECT e.last_name, m.last_name, department_name FROM employees e LEFT OUTER JOIN employees m on ( e.manager_id = m.employee_id) LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);
  2. C. SELECT e.last_name, m.last_name, department_name FROM employees e RIGHT OUTER JOIN employees m on ( e.manager_id = m.employee_id) LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);
  3. D. SELECT e.last_name, m.last_name, department_name FROM employees e LEFT OUTER JOIN employees m on ( e.manager_id = m.employee_id) RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);
  4. E. SELECT e.last_name, m.last_name, department_name FROM employees e RIGHT OUTER JOIN employees m on ( e.manager_id = m.employee_id) RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);
  5. F. SELECT last_name, manager_id, department_name FROM employees e JOIN departments d ON (e.department_id = d.department_id) ;

116. Mark for review Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID             NUMBER NOT              NULL, Primary Key
EMP_NAME                  VARCHAR2 (30)
JOB_ID                         NUMBER
SAL                              NUMBER
MGR_ID                        NUMBER References EMPLOYEE_ID column
DEPARTMENT_ID         NUMBER Foreign key to DEPARTMENT_ID column of the DEPARTMENTS table
You created a sequence called EMP_ID_SEQ in order to populate sequential values for the EMPLOYEE_ID column of the EMPLOYEES table.

Which two statements regarding the EMP_ID_SEQ sequence are true? (Choose two.)

  1. You cannot use the EMP_ID_SEQ sequence to populate the JOB_ID column.
  2. The EMP_ID_SEQ sequence is invalidated when you modify the EMPLOYEE_ID column.
  3. The EMP_ID_SEQ sequence is not affected by modifications to the EMPLOYEES table.
  4. Any other column of NUMBER data type in your schema can use the EMP_ID_SEQ sequence.
  5. The EMP_ID_SEQ sequence is dropped automatically when you drop the EMPLOYEES table.
  6. The EMP_ID_SEQ sequence is dropped automatically when you drop the EMPLOYEE_ID column.

117. Mark for review. Which two are true about aggregate functions? (Choose two.)

  1. You can use aggregate functions in any clause of a SELECT statement.
  2. You can use aggregate functions only in the column list of the SELECT clause and in the WHERE clause of a SELECT statement.
  3. You can mix single row columns with aggregate functions in the column list of a SELECT statement by grouping on the single row columns.
  4. You can pass column names, expressions, constants, or functions as parameters to an aggregate function.
  5. You can use aggregate functions on a table, only by grouping the whole table as one single group.
  6. You cannot group the rows of a table by more than one column while using aggregate functions.

118. Mark for review Examine the structure of the STUDENTS table:

STUDENT_ID                NUMBER NOT              NULL, Primary Key
STUDENT_NAME          VARCHAR2 (30)
COURSE_ID                 VARCHAR2 (10)            NOT NULL
MARKS                        NUMBER
START_DATE               DATE
FINISH_DATE               DATE

You need to create a report of the 10 students who achieved the highest ranking in the course INT_SQL and who completed the course in the year 1999.
Which SQL statement accomplishes this task?

  1. SELECT student_id, marks, ROWNUM "Rank" FROM students WHERE ROWNUM <= 10 AND finish_date BETWEEN '01-JAN-99' AND '31-DEC-99' AND course_id = 'INT_SQL'ORDER BY marks DESC;
  2. SELECT student_id, marks, ROWID "Rank" FROM students WHERE ROWID <= 10 AND finish_date BETWEEN '01-JAN-99' AND '31-DEC-99'AND course_id = 'INT_SQL'ORDER BY marks;
  3. SELECT student_id, marks, ROWNUM "Rank" FROM (SELECT student_id, marks FROM students WHERE ROWNUM <= 10 AND finish_date BETWEEN '01-JAN-99' AND '31-DEC-99' AND course_id = 'INT_SQL' ORDER BY marks DESC);
  4. SELECT student_id, marks, ROWNUM "Rank" FROM (SELECT student_id, marks FROM students WHERE finish_date BETWEEN '01-JAN-99' AND '31-DEC-99' AND course_id = 'INT_SQL' ORDER BY marks DESC)WHERE ROWNUM <= 10 ;
  5. SELECT student_id, marks, ROWNUM "Rank" FROM (SELECT student_id, marks FROM students ORDER BY marks) WHERE ROWNUM <= 10 AND finish_date BETWEEN '01-JAN-99' AND '31-DEC-99' AND course_id = 'INT_SQL';

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

  1. The underlying tables must have data.
  2. You need SELECT privileges on the view.
  3. The underlying tables must be in the same schema.
  4. You need SELECT privileges only on the underlying tables.

120. 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                     VARCHAR2 (30)
SALARY                       NUMBER (8, 2)

Which statement shows the maximum salary paid in each job category of each department?

  1. SELECT dept_id, job_cat, MAX (salary) FROM employees WHERE salary > MAX (salary);
  2. SELECT dept_id, job_cat, MAX (salary) FROM employees GROUP BY dept_id, job_cat
  3. SELECT dept_id, job_cat, MAX(salary) FROM employees;
  4. SELECT dept_id, job_cat, MAX (salary) FROM employees GROUP BY dept_id;
  5. SELECT dept_id, job_cat, MAX (salary) FROM employees GROUP BY dept_id, job_cat, salary;

121. Which SELECT statement will get the result 'elloworld' from the string 'HelloWorld'?

  1. SELECT SUBSTR ('HelloWorld',1) FROM dual;
  2. SELECT INITCAP(TRIM('HellowWorld', 1,1) FROM dual
  3. SELECT LOWER (SUBSTR ('HellowWorld', 2,1) FROM dual
  4. SELECT LOWER (SUBSTR('HellowWorld', 2,1) FROM dual
  5. SELECT LOWER (TRIM ('H' FROM 'Hello World')) FROM dual
   
122. Management has asked you to calculate the value 12* salary* commission_pct for all the employees in the EMP table. The EMP table contains these columns:

LAST NAME                 VARCHAR2 (35)            NOT NULL
SALARY                       NUMBER (9, 2) NOT NULL
COMMISSION_PCT      NUMBER (4, 2)

Which statement ensures that a value is displayed in the calculated column for all employees?

  1. SELECT last_name, 12 * salary* commission_pct FROM emp;
  2. SELECT last_name, 12 * salary* (commission_pct,0) FROM emp;
  3. SELECT last_name, 12 * salary* (nvl(commission_pct,0) FROM emp;
  4. SELECT last_name, 12 * salary* (decode(commission_pct,0)) FROM emp;

123. From SQL*Plus, you issue this SELECT statement:
SELECT * FROM orders;
You use this statement to retrieve data from a database table for _______________. (Choose all that apply)
A. updating
B. viewing
C. deleting
D. inserting
E. truncating

124. Which four statements correctly describe functions that are available in SQL? (Choose four)

  1. INSTR returns the numeric position of a named character
  2. NVL 2 returns the first non-null expression in the expression list.
  3. TRUNCATE rounds the column, expression, or value to n decimal places
  4. DECODE translates an expression after comparing it to each search value
  5. TRIM trims the leading or trailing characters (or both) from a character string.
  6. NVL compares two expressions and returns null if they are equal, or the first expression if they are not equal.
  7. NULLIF compares two expressions and returns null if they are equal, or the first expression if they are not equal.

125. The EMPLOYEES table has these columns:

LAST_NAME                VARCHAR2 (35)
SALARY                       NUMBER (8, 2)
COMMISSION_PCT      NUMBER (5, 2)

You want to display the name and annual salary multiplied by the commission_pct for all employees. For records that have a NULL commission_pct, a zero must be displayed against the calculated column. Which SQL statement displays the desired results?

  1. SELECT last_name, (salary*12)* commission_Pct FROM EMPLOYEES;
  2. SELECT last_name, (salary*12)* IFNULL(commission_pct,0) FROM EMPLOYEES;
  3. SELECT last_name, (salary*12)* NVL2(commission_pct,0) FROM EMPLOYEES;
  4. SELECT last_name, (salary*12)* NVL(commission_pct,0) FROM EMPLOYEES;

126. Which two statements is true regarding the ORDER BY clause? (Choose two)

  1. The sort is in ascending order by default
  2. The sort is in descending order by default
  3. The ORDER BY clause must precede the WHERE clause.
  4. The ORDER BY clause is executed on the client side
  5. The ORDER BY clause comes last in the SELECT statement
  6. The ORDER BY clause is executed first in the query execution.

127. Click the Exhibit button and examine the data from the ORDERS and CUSTOMERS tables. ORDERS

ORD_ID            ORD_DATE       CUST_ID          ORD_TOTAL


100                   12.JAN.2000     15                     10000
101                   09.MAR.2000    40                     8000
102                   09.MAR.2000    35                     12500
103                   15.MAR.2000    15                     12000
104                   25.JUN.2000     15                     6000
105                   18.JUL.2000      20                     5000
106                   18.JUL.2000      35                     7000
107                   21.JUL.2000      20                     6500
108                   04.AUG.2000     10                     8000

CUSTOMERS
CUST_ID          CUST_NAME    CITY
10                     Smith                Los Angeles
15                     Bob                  San Francisco
20                     Martin               Chicago
25                     Mary                 New York
30                     Rina                  Chicago
35                     Smith                New York
40                     Linda                New York

Which SQL statement retrieves the order ID, customer ID, and order total for the orders that are placed on the same day that Martin paced his orders?

A.      SELECT ord_id, cust_id, ord_total FROM orders, customers WHERE cust_name='Martin' AND ord_date IN ('18-JUL-2000'; 21-JUL-2000');
B.      SELECT ord_id, cust_id, ord_total FROM orders WHERE ord_date IN (SELECT ord_date FROM orders WHERE cust_id=(SELECT cust_id FROM customers WHERE cust_name= 'Martin'));
C.      SELECT ord_id, cust_id, ord_total FROM orders WHERE ord_date IN (SELECT ord_date FROM orders, customers WHERE cst_name='Martin');
D.     SELECT ord_id, cust_id, ord_total FROM orders WHERE cust_id IN (SELECT cust_id FROM customers WHERE cust name = 'Martin')

128. Evaluate the SQL statement:
SELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a, (SELECT dept_id, MAX (sal) maxsal 4 FROM employees GROUP BY dept_id) b WHERE a.dept_id = b.dept_id AND a.sal
What is the result of the statement?

  1. The statement produces an error at line1.
  2. The statement produces an error at line3.
  3. The statement produces an error at line6.
  4. The statement returns the employee name, salary, department ID, and maximum salary earned in the department of the employee for all departments that pay less salary than the maximum salary aid in the company.
  5. The statement returns the employee name, salary, department ID, and maximum salary earned in the department of the employee for all employees who earn less than the maximum salary in their department.

129. Click the Exhibit button and examine the data in the EMPLOYEES and DEPARTMENTS tables.
EMPLOYEES
EMP_ID            EMP_NAME      DEPT_ID          MGR_ID            JOB_ID SALARY
101                   Smith               20                     120                   SA_REP           4000
102                   Martin              10                     105                   CLERK             2500
103                   Chris                20                     120                   IT ADMIN          4200
104                   John                30                     108                   HR_CLERK       2500
105                   Diana               30                     108                   IT_ADMIN         5000
106                   Smith               40                     110                   AD_ASST         3000
108                   Jennifer            30                     110                   HR_DIR            6500
110                   Bob                  40                                             EX_DIR            8000
120                   Ravi                 20                     110                   SI_DIR              6500

DEPARTMENTS

DEPARTMENT_ID         DEPARTMENT NAME
10                                 Admin
20                                 Education
30                                 IT
40                                 Human Resources

Also examine the SQL statements that create the EMPLOYEES and DEPARTMENTS tables:

CREATE TABLE departments (department_id NUMBER PRIMARY KEY, department_name VARCHAR2 (30));

CREATE TABLE employees (EMPLOEE_ID NUMBER PRIMARY KEY, EMP_NAME VARCHAR2 (20), DEPT_ID NUMBER REFERENCES departments (department_id) MGR_ID NUMBER REFERENCES employees (employee id), JOB_ID VARCHAR2 (15). SALARY NUMBER);

On the EMPLOYEES table, EMPLOYEE_ID is the primary key MGR_ID is the ID of mangers and refers to the EMPLOYEE_ID DEPT_ID is foreign key to DEPARTMENT_ID column of the DEPARTMENTS table

On the DEPARTMENTS table, DEPARTMENT_ID is the primary key. Examine this DELETE statement: DELETE FROM departments WHERE department id=40;

What happens when you execute the DELETE statement?


  1. Only the row with department ID 40 is deleted in the DEPARTMENTS table.
  2. The statement fails because there are child records in the EMPLOYEES table with department ID 40.
  3. The row with department ID 40 is deleted in the DEPARTMENTS table. Also the rows with employee IDs 110 and 106 are deleted from the EMPLOYEES table.
  4. The row with department ID 40 is deleted in the DEPARTMENTS table. Also the rows with employee IDs 106 and 110 and the employees working under employee 110 are deleted from the EMPLOYEES table.
  5. The row with department ID 40 is deleted in the DEPARTMENTS table. Also all the rows in the EMPLOYEES table are deleted.
  6. The statement fails because there are no columns specified in the DELETE clause of the DELETE statement.

130. Mary has a view called EMP_DEPT_LOC_VU that was created based on the EMPLOYEES, DEPARTMENTS, and LOCATIONS tables. She granted SELECT privilege to Scott on this view. Which option enables Scott to eliminate the need to qualify the view with the name MARY.EMP_DEPT_LOC_VU each time the view is referenced?

  1. Scott can create a synonym for the EMP_DEPT_LOC_VU by using the command CREATE PRIVATE SYNONYM EDL_VU FOR mary.EMP DEPT_LOC_VU; then he can prefix the columns with this synonym
  2. Scott can create a synonym for the EMP_DEPT_LOC_VU by using the command CREATE SYNONYM EDL_VU FOR mary.EMP DEPT_LOC_VU; then he can prefix the columns with this synonym.
  3. Scott can create a synonym for the EMP_DEPT_LOC_VU by using the command CREATE LOCAL SYNONYM EDL_VU FOR mary.emp dept_LOC_uv; then he can prefix the columns with the synonym.
  4. Scott can create a synonym for the EMP_DEPT_LOC_VU by using the command CRETE LOCAL SYNONYM EDL_VU ON Mary(EMP_DEPT_LOC_VU); then he can prefix the columns with this synonym
  5. Scott cannot create a synonym because synonyms can be created only for tables.
  6. Scott cannot create any synonym for Mary's view. Mary should create a private synonym for the view and grant SELECT privilege on that synonym to Scott.

131. Which SQL statement defines a FOREIGN KEY constraint on the DEPT NO column of the EMP table?

  1. CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35), deptno NUMBER(7,2) NOT NULL, CONSTRAINT emp_deptno_fk FOREIGN KEY deptno REFERENCES dept deptno);
  2. CREATE TABLE EMP (empno NUMBER(4), ename VARCHAR2(35), deptno NUMBER(7,2) CONSTRAINT emp_deptno_fk REFERENCES dept (deptno));
  3. CRETE TABLE EM (empno NUMBER(4), ename VARCHAR2(35) deptno NUMBER (7,2) NOT NULL, CONSTRAINT em_deptno_fk REFERENCES dept (deptno) FOREIGN KEY (deptno));
  4. CREATE TABLE EMP (empno NUMBER (4), ename VARCHAR2(35), deptno NUMBER(7,2) FOREIGN KEY CONSTRAINT emp deptno fk REFERENCES dept (deptno));

132. Evaluate the set of SQL statements:
CREATE TABLE dept (dept_id NUMBER (2) dname VARCHAR2 (14), Loc VARCHAR2 (13)); ROLLBACK;
DESCRIBE DEPT
What is true about the set?

  1. The DESCRIBE DEPT statement displays the structure of the DEPT table
  2. The ROLLBACK statement frees the storage space occupied by the DEPT table.
  3. The DESCRIBE DEPT statement returns an error ORA-04043: object DEPT does not exist
  4. The DESCRIBE DEPT statement displays the structure of the DEPT table only if there is a COMMIT statement introduced before the ROLLBACK statement.

133. Examine the structure of the EMPLOYEES and DEPARTMENTS 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 DEPARTMENT_ID column of the DEPARTMENT table

DEPARTMENTS
DEPARTMENT_ID                     NUMBER                      NOT NULL, Primary key
DEPARTMENT_NAME              VARCHAR2 (30)
MGR_ID                                    NUMBER                      References MGR_ID column of the EMPLOYEES table
Evaluate this SQL statement;
SELECT employee_id, e.department_id, department_name, salary FROM employees e, departments d WHERE e. department_id=d.department_id;

Which SQL statement is equivalent to the above SQL statement?


  1. SELECT employee_id, department_id, department_name, salary FROM employees WHERE department_id IN (SELECT department_id FROM departments);
  2. SELECT employee_id, department_id, department_name, salary FROM employees NATURAL JOIN departments d ON e.department_id=d.department_id;
  3. SELECT employee_id, department_id, department_name, salary FROM employees e JOIN departments d ON e.department_id=d.department_id;
  4. SELECT employee_id, department_id, department_name, salary FROM employees JOIN departments USING (e.department_id, d.department_id);

134. Which SQL statement generates the alias Annual Salary for the calculated column SALARY*12?

  1. SELECT ename, salary*12'Annual Salary' FROM employees;
  2. SELECT ename, salary* 12 "Annual Salary" FROM employees
  3. SELECT ename, salary* 12 AS Annual Salary FROM employees;
  4. SELECT ename, salary* 12 AS INITCAP("ANNUAL SALARY") FROM employees

135. In which scenario would an index be most useful?

  1. The indexed column is declared as NOT NULL.
  2. The indexed columns are used in the FROM clause
  3. The indexed columns are part of an expression
  4. The indexed column contains a wide range of values.

136. Which two are attributes of /SQL*Plus? (Choose two)

  1. /SQL*Plus commands cannot be abbreviated.
  2. /SQL*Plus commands are accesses from a browser.
  3. /SQL*Plus commands are used to manipulate data in tables.
  4. /SQL*Plus commands manipulate table definitions in the database.
  5. /SQL*Plus is the Oracle proprietary interface for executing SQL statements.

Answer: B, E

137. Which three statements about Subqueries are true? (Choose three).

  1. A single row subquery can retrieve only one column and one row
  2. A single row subquery can retrieve only one row but many columns
  3. A multiple row subquery can retrieve multiple rows and multiple columns
  4. A multiple row subquery can be compared using the ">" operator
  5. A single row subquery can use the IN operator
  6. A multiple row subquery can use the "=" operator

138. When should you create a role? (Choose two)

  1. to simplify the process of creating new users using the CREATE USER xxx IDENTIFIED by yyyy statement
  2. to grant a group of related privileges to a user
  3. When the number of people using the database is very high
  4. to simplify the process of granting and revoking privileges
  5. To simplify profile maintenance for a user who is constantly traveling.

139. Which clause would you use in a SELECT statement to limit the display to those employees whose salary is greater than 5000?

  1. ORDER BY SALARY > 5000
  2. GROUP BY SALARY > 5000
  3. HAVING SALARY > 5000
  4. WHERE SALARY > 5000

140. Which four are correct guidelines for naming database tables? (Choose four)

  1. Must begin with either a number or a letter
  2. must be 1-30 characters long
  3. Should not be an Oracle Server reserved word.
  4. must contain only A-Z, a-z, 0-9, _,*, and #
  5. must contain only A-Z, a-z, 0-9, _, $, and #
  6. must begin with a letter

140. Which two statements about sequences are true? (Choose two)

  1. You use a NEXTVAL pseudo column to look at the next possible value that would be generated from a sequence, without actually retrieving the value.
  2. You use a CURRVAL pseudo column to look at the current value just generated from a sequence, without affecting the further values to be generated from the sequence.
  3. You use a NEXTVAL pseudo column to obtain the next possible value from a sequence by actually retrieving the value form the sequence
  4. You use a CURRVAL pseudo column to generate a value from a sequence that would be used for a specified database column.
  5. If a sequence starting from a value 100 and incremented by 1 is used by more than one application, then all of these applications could have a value of 105 assigned to their column whose value is being generated by the sequence.
  6. You use a REUSE clause when creating a sequence to restart the sequence once it generates the maximum value defined for the sequence.

141. Examine the description of the MARKS table:

STD_ID                         NUMBER (4)
STUDENT_NAME          VARCHAR2 (30)
SUBJ1                          NUMBER (3)
SUBJ2                          NUMBER (3)
SUBJ1 and SUBJ2 indicate the marks obtained by a student in two subjects
Examine this SELECT statement based on the MARKS table:
SELECT subj1+subj2 total_marks, std_id FROM marks WHERE subj1 > AVG (subj1) AND subj2 > AVG (subj2) ORDER BY total_marks;
What us the result of the SELECT statement?

  1. The statement executes successfully and returns the student ID and sum of all marks for each student who obtained more than the average mark in each subject.
  2. The statement returns an error at the SELECT clause
  3. The statement returns an error at the WHERE clause
  4. The statement returns an error at the ORDER BY clause

142. You want to display the titles of books that meet these criteria:
1. Purchased before January 21, 2001
2. Price is less than $ 500 or greater than $ 900
You want to sort the result by their date of purchase, starting with the most recently bought book. Which statement should you use?

  1. SELECT book_title FROM books WHERE price between 500 and 900 AND purchase_date < '21 - Jan-2001' ORDER BY purchase_date;
  2. SELECT book_title FROM books WHERE price IN (500, 900) AND purchase_date< '21-jan-2001' ORDER BY purchase date ASC;
  3. SELECT book_title FROM books WHERE price < 500 OR>900 AND purchase_date DESC;
  4. SELECT Book_title FROM books WHERE price < 500 OR>900 AND purchase_date<'21-JAN-2001' ORDER BY purchase date DESC;
  5. SELECT book_title FROM books WHERE (price< 500 OR price> 900) AND purchase date> '21 - JAN-2001' ORDER BY purchase date ASC;

143. Click the Exhibit button to examine the structure of the EMPOLOYEES, DEPARTMENTS and TAX tables.
EMPLOYEES

EMPLOYEE_ID             NUMBER                      NOT NULL        primary key
EMP_NAME                  VARCHAR2 (30)
JOB_ID                         VARCHAR2 (20)
SALARY                       NUMBER
MGR_ID                        NUMBER                      Reference EMPLOYEE_ID Column
DEPARTMENT_ID         NUMBER                      Foreign key to DEPARTMENT_ID TO column of the DEPARTMENT table

DEPARTMENTS
DEPARTMENT_ID         NUMBER                      NOT NULL        primary key
DEPARTMENT_NAME VARCHAR2 (30)
MGR_ID                        NUMBER                      Reference MGR_ID column of the EMPLOYEES table

TAX
MIN_SALARY               NUMBER
MAX_SALARY              NUMBER
TAX_PERCENT            NUMBER

For which situation would you use a nonequijoin query?


  1. to find the tax percentage for each of the employees
  2. to list the name, job id, and manager name for all the employees
  3. to find the name, salary and the department name of employees who are not working with Smith
  4. to find the number of employees working for the Administrative department and earning less than 4000
  5. to display name, salary, manager ID, and department name of all the employees, even if the employees do not have a department ID assigned

144. Which operator can be used with a multiple row subquery?

 A. =
B. LIKE
C. BETWEEN
D. NOT IN
E. Is
F. <>

145. You need to perform certain data manipulation operations through a view called EMP_DEPT_VU, which you previously created. You want to look at the definition of the view (the SELECT statement on which the view was created). How do you obtain the definition of the view?

  1. Use the DESCRIBE command on the EMP_DEPT VU view
  2. Use the DEFINE VIEW command on the EMP_DEPT VU view
  3. Use the DESCRIBE VIEW command on the EMP_DEPT VU view
  4. Query the USER_VIEWS data dictionary view to search for the EMP_DEPT_VU view
  5. Query the USER_SOURCE data dictionary view to search for the EMP_DEPT_VU view
  6. Query the USER_OBJECTS data dictionary view to search for the EMP_DEPT_VU view

146. Which statement explicitly names a constraint?

  1. ALTER TABLE student_grades ADD FOREIGN KEY (student_id) REFERENCES students (student_id);
  2. ALTER TABLE student_grades ADD CONSTRAINT NAME=student_id_fk FOREIGN KEY (student_id) REFERENCES student(student_id);
  3. ALTER TABLE student_grades ADD CONSTRAINT student_id_fk FOREIGN KEY (student_id) REFERENCES students (student_id);
  4. ALTER TABLE student grades ADD NAMED CONSTRAINT student_id_fk FOREIGN KEY (student_id) REFERENCES students (student_id)
  5. ALTER TABLE student grades ADD NAME student_id_fk FOREIGN KEY (student_id) REFERENCES students (student_id)

147. You need to display the last names of those employees who have the letter "A" as the second character in their names. Which SQL statement displays the required results?

  1. SELECT last_name FROM EMP WHERE last_name LIKE'_A%;
  2. SELECT last_name FROM EMP WHERE last name='*A%
  3. SELECT last_name FROM EMP WHERE last name ='* _A%;
  4. SELECT last_name FROM EMP WHERE last name LIKE '* a%

148. Which two statements about creating constraints are true? (Choose two)
  1. Constraint names must start with SYS_C.
  2. All constraints must be defined at the column level
  3. Constraints can be created after the table is created
  4. Constraints can be created at the same time the table is created
  5. Information about constraints is found in the VIEW_CONSTRAINTS dictionary view

149. You are granted the CREATE VIEW privilege. What does this allow you to do?

  1. create a table view
  2. create a view in any scheme
  3. create a view in your schema
  4. create a sequence view in any schema
  5. create a view that is accessible by everyone
  6. create a view only if it is based on tables that you created

150. 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 table.

How can you accomplish this task?


  1. ALTER VIEW emp_dept_vu (ADD manager_id NUMBER),
  2. MODIFY VIEW emp_dept_vu (ADD manager_id NUMBER);
  3. ALTER VIEW emp_dept_vu AS SELECT employee_id, employee_name Department_name, manager_id FROM employees e, departments d WHERE department_id = d.department_id;
  4. MODIFY VIEW emp_depat_vu AS SELECT employee_id, employee_name, Department_name, manager_id FROM employees e, departments d WHERE e.department_id = d.department_id;
  5. 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;
  6. You must remove the existing view first, and then run the CRATE VIEW command with a new column list to modify a view.

151. 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 UPDATE statement is valid?


  1. UPDATE new_employees SET name=(SELECT last_name|| First_name FROM employees WHERE employee_id = 180)
  2. B. UPDATE new_employees SET name = (SELECT Last_name || first_name FROM employees) WHERE employee_id = 180
  3. C. UPDATE new_employees SET name = (SELECT last_name|| First_name FROM employees WHERE employee_id = 180 WHERE employee_id = (SELECT employee_id FROM new employees),
  4. D. UPDATE new_employees SET name = (SELECT last name|| First_name FROM employees WHERE employee_id= (SELECT employee_id WHERE employee_id FROM new_employees)) WHERE employee_id = 180,

152. You need to produce a report for mailing labels for all customers. The mailing label must have only the customer name and address. The CUSTOMER table has these columns:
CUST_ID                      NUMBER (4)                 NOT NULL
CUST_NAME                VARCHAR2 (100)          NOT NULL
CUST_ADDRESS          VARCHAR2 (150)
CUST_PHONE              VARCHAR (20)

Which SELECT statement accomplishes this task?


  1. SELECT * FROM customers
  2. SELECT name, address FROM customers;
  3. SELECT id, name, address, phone FROM customers;
  4. SELECT cust_name, cust_address FROM customers;
  5. SELECT cust_id, cust_name, cust_address, cust_phone FROM customers;

153. Which substitution variable would you use if you want to reuse the variable value without prompting the user each time?

  1. &
  2. ACCEPT
  3. PROMPT
  4. &&

154. Examine the structure of the EMPLOYEES table:
Column name              Data type                      Remarks
EMPOYEE_ID               NUMBER                      NOT NULL, Primary Key
EMP_NAME                  VARCHAR2 (30)

JOB_ID                         VARCHAR2 (20)            NOT NULL

SAL                              NUMBER
MGR_ID                        NUMBER                      References EMPLOYEE_ID column
DEPARTMENT_ID         NUMBER                      Foreign key to DEPARTMENT_ID column Of the DEPARTMENTS table

You need to create a view called EMP_VU that allows the users to insert rows through the view. Which SQL statement, when used to create the EMP_VU view, allows the users to insert rows?
  1. CREATE VIEW emp_Vu AS SELECT employee_id, emp_name, Department_id FROM employees WHERE mgr_id IN (102,120);
  2. CREATE VIEW emp_Vu AS SELECT employee_id, emp_name, job_id, Department_id FROM employees WHERE mgr_id IN (102, 120);
  3. CREATE VIEW emp_Vu AS SELECT department_id, SUM(sal) TOTAL SAL FROM employees WHERE mgr_id IN (102, 120) GROUP BY department_id;
  4. CREATE VIEW emp_Vu AS SELECT employee_id, emp_name, job_id, DISTINCT department_id FROM employees

155. What is true about the WITH GRANT OPTION clause?

  1. It allows a grantee DBA privileges
  2. B. It is required syntax for object privileges
  3. It allows privileges on specified columns of tables
  4. It is used to grant an object privilege on a foreign key column
  5. It allows the grantee to grant object privileges to other users and roles

156. The STUDENT_GRADES table has these columns
STUDENT_ID                NUMBER (12)
SEMESTER_END         DATE
GPA                             NUMBER (4, 3)
The registrar has asked for a report on the average grade point average (GPA) for students enrolled during semesters that end in the year 2000. Which statement accomplishes this?

A.      SELECT AVERAGE(gpa) FROM student_grades WHERE semester_end > '01-JAN-2000' and semester end < '31-DEC-2000'
  1. SELECT COUNT (gpa) FROM student grades WHERE semester_end > '01-JAN-2000' and semester end < '31-DEC-2000'
  2. SELECT MID (gpa) FROM student_grades WHERE semester_end > '01-JAN-2000' and semester end < '31-DEC-2000' D. SELECT AVG (gpa) FROM student_grades WHERE semester_end > '01-JAN-2000' and semester end < '31-DEC-2000'
  3. SELECT SUM (gpa) FROM student_grades WHERE semester_end > '01-JAN-2000' and semester end < '31-DEC-2000'
  4. SELECT MEDIAN (gpa) FROM student_grades WHERE semester_end > '01-JAN-2000' and semester end < '31-DEC-2000'

157. In which scenario would Top N analysis be the best solution?

  1. You want to identify the most senior employee in the company
  2. You want to find the manager supervising the largest number of employees
  3. You want to identify the person who makes the highest salary of all employees
  4. You want to rank the top three sales representatives who have sold the maximum number of products

158. Click the Exhibit button to examine the data of the EMPLOYEES table.

EMPLOYEES (EMPLOYEE_ID is the primary key.
MGR_ID is the ID of managers and refers to the EMPLOYEE_ID)

EMPLOYEE_ID - EMP_NINE - DEPT_ID - MGR_ID - JOB_ID - SALARY

101 - Smith - 20 - 120 - SA_REP - 4000
102 - Martin - 10 - 105 - CLERK - 2500
103 - Chris - 20 - 120 - IT_ADMIN - 4200
104 - John - 30 - 108 - HR_CLERK - 2500
105 - Diana - 30 - 108 - HR_MGR - 5000
106 - Bryan - 40 - 110 - AD_ASST - 5000
108 - Jennifer - 30 - 110 - HR_DIR - 6500
110 - Bob - 40 - ** - EX_DIR - 8000
120 - Ravi - 20 - 110 - SA_DIR - 6500

Which statement lists the ID, name, and salary of the employee, and the ID and name of the employee's manager, for all the employees who have a manager and earn more than 4000?

  1. SELECT employee_id "Emp_id", emp_name "Employee", salary, employee_id "Mgr_id", emp_name "Manager" FROM employees WHERE salary > 4000;
  2. SELECT e.employee_id "Emp_id", e.emp_name "Employee" ,e.salary, m.employee_id "Mgr_id", m.emp_name "Manager" FROM employees e, employees m WHERE e.mgr_id = m.mgr_id AND e.salary > 4000;
  3. SELECT e.employee_id "Emp_id", e.emp_name "Employee" ,e.salary, m.employee_id "Mgr_id", m.emp_name "Manager" FROM employees e, employees m WHERE e.mgr_id = m.employee_id AND e.salary > 4000;
  4. SELECT e.employee_id "Emp_id", e.emp_name "Employee" ,e.salary, m.mgr_id "Mgr_id", m.emp_name "manager" FROM employees e, employees m WHERE e.mgr_id = m.employee_id AND e.salary > 4000;
  5. SELECT e.employee_id "Emp_id", e.emp_name "Employee" ,e.salary, m.mgr_id "Mgr_id", m.emp_name "Manager" FROM employees e, employees m WHERE e.employee_id = m.employee_id AND e.salary > 4000;

159. What does the TRUNCATE statement do?

  1. removes the table
  2. removes all rows from a table
  3. shortens the tale to 10 rows
  4. removes all columns from a table
  5. removes foreign keys from a table

160. The ORDERS table has these columns

ORDER_ID                    NUMBER (4)                 NOT NULL
CUSTOMER_ID             NUMBER (12)                NOT NULL
ORDER_TOTAL            NUMBER (10, 2)

The ORDERS table tracks the Order number, the order total and the customer to whom the Order belongs. Which two statements retrieve orders with an inclusive total that ranges between 100.00 and 200.00 dollars? (Choose Two).

A.      SELECT customer_id, order_id, order_total FROM orders RANGE ON order_total (100 AND 2000) INCLUSIVE
B.      SELECT customer_id, order_id, order_total FROM orders HAVING order total BETWEEN 100 and 2000
C.      SELECT customer_id, order_id, order_total FROM orders WHERE order_total BETWEEN 100 and 2000
D.     SELECT customer_id, order_id, order_total FROM orders WHERE order_total >= 100 and <=2000
E.      SELECT customer_id, order_id, order _total FROM orders WHERE order_total>= 100 and order_total <=2000.

161. The EMPLOYEES table contains these columns:
LAST_NAME                VARCHAR2 (25)
SALARY                       NUMBER (6, 2)
COMMISSION_PCT      NUMBER (6)

You need to write a query that will produce these results:
1. Display the salary multiplied by the commission_pct
2. Exclude employees with a zero commission_pct
3. Display a zero for employees with a null commission value

Evaluate the SQL statement:
SELECT LAST_NAME, SALARY * COMMISSION_PCT FROM EMPLOYEES WHERE COMMISSION_PCT IS NOT NULL;

What does the statement provide?


  1. all of the desired results
  2. two of the desired results
  3. one of the desired results
  4. an error statement

162. A subquery can be used to _________.

  1. create groups of data
  2. sort data in a specific order
  3. convert data to a different format
  4. retrieve data based on an unknown condition

163. Which clause should you use to exclude group results?

A. WHERE
B. HAVING
C. RESTRICT
D. GROUP BY
E. ORDER BY

164. Scott issues the SQL statements:
CREATE TABLE dept (deptno number (2) dname VARCHAR2 (14) loc VARCHAR2 (13));
GRANT SELECT ON DEPT TO SUE;
If Sue needs to select from Scott's DEPT table, which command should she use?

A. SELECT * FROM DEPT
B. SELECT * FROM SCOTT.DEPT
C. SELECT * FROM DBA.SCOTT.DEPT.
D. SELECT * FROM ALL_USERS WHERE USER_NAME = 'SCOTT' AND TABLE NAME= 'DEPT';

165. Examine the data in the EMPLOYEES and EMP_HIST tables:
EMPLOYEES
EMPLOYEE_IDNAME   DEPT_ID          MGR_ID            JOB_ID SALARY
101 - Smith - 20 - 120 - SA_REP - 4000
102 - Martin - 10 - 105 - CLERK - 2500
103 - Chris - 20 - 120 - IT_ADMIN - 4200
104 - John - 30 - 108 - HR_CLERK - 2500
105 - Diana - 30 - 108 - IT_ADMIN - 5000
106 - Smith - 40 - 110 - AD_ASST - 3000
108 - Jennifer - 30 - 110 - HR_DIR - 6500
110 - Bob - 40 - ** - EX_DIR - 8000
120 - Ravi - 20 - 110 - SA_DIR - 6500

EMP_HIST
EMPLOYEE_ID - NAME - JOB_ID - SALARY
101 - Smith - SA_CLERK - 2000
103 - Chris - IT_CLERK - 22
104 - John - HR_CLERK - 2000
106 - Smith - AD_ASST - 3000
108 - Jennifer - HR_MGR – 4500

The EMP_HIST table is updated at the end of every year. The employee ID, name, jobID, and salary of each existing employee are modified with the latest data. New employee details are added to the table. Which statement accomplishes this task?

  1. UPDATE emp_hist SET employee_id, name, job_id, salary = (SELECT employee_id, name, job_id, salary FROM employees) WHERE employee_id IN (SELECT employee_id FROM employees);
  2. MERGE INTO emp_hist eh USING employees e ON (eh.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE SET eh.name = e.name, eh.job_id = e.job_id, eh.salary = e.salary WHEN NOT MATCHED THEN INSERT VALUES (e.employee_id, e.name, e.job_id id, e.salary);
  3. MERGE INTO emp_hist eh USING employees e ON (eh.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE emp_hist SET eh.name = e.name, eh.job_id = e.job_id, eh.salary = e.salary WHEN NOT MATCHED THEN INSERT INTO emp_hist VALUES (e.employee_id, e.name, e.job_id, e.salary);
  4. MERGE INTO emp_hist eh USING employees e WHEN MATCHED THEN UPDATE emp_hist SET eh.name = e.name, eh.job_id = e.job_id, eh.salary = e.salary WHEN NOT MATCHED THEN INSERT INTO emp_hist VALUES (e.employee_id, e.name, e.job_id, e.salary);

166. You need to calculate the total of all salaries in the accounting department. Which group function should you use?

A. MAX
B. MIN
C. SUM
D. COUNT
E. TOTAL
F. LARGEST

167. The EMP table has these columns:
ENAME                        VARCHAR2 (35)
SALARY                       NUMBER (8, 2)
HIRE_DATE                  DATE
Management wants a list of names of employees who have been with the company for more than five yeas. Which SQL statement displays the required results?

  1. SELECT ENAME FROM EMP WHERE SYSDATE-HIRE_DATE>5
  2. SELECT ENAME FROM EMP WHERE HIRE_DATE-SYSDATE > 5
  3. SELECT ENAME FROM EMP WHERE (SYSDATE-HIRE_DATE)/365 > 5
  4. SELECT ENAME FROM EMP WHERE (SYSDATE-HIRE_DATE)* 365 > 5

168. You would like to display the system date in the format *Monday, 01 June, 2001* Which SELECT statement should you use?

  1. SELECT TO_DATE (SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual
  2. SELECT TO_CHAR(SYSDATE, 'FMDD, DY Month 'YYY') FROM dual
  3. SELECT TO_CHAR(SYSDATE, 'FMDay, DD Month YYYY') FROM dual
  4. SELECT TO_CHAR(SYSDATE, 'FMDAY, DDD Month, YYYY') FROM dual
  5. SELECT TO_DATES(SYSDATE,'FMDY, DDD Month, YYYY') FROM dual

169. The CUSTOMERS table has these columns:

CUSTOMER_ID             NUMBER (4)                 NOT NULL
CUSTOMER_NAME      VARCHAR2 (100)
STREET_ADDRESS      VARCHAR2 (150)
CITY_ADDRESS           VARCHAR2 (50)
STATE_ADDRESS        VARCHAR2 (50)
PROVINCE_ADDRESS VARCHAR2 (50)
COUNTRY_ADDRESS   VARCHAR2 (50)
POSTAL_CODE            VARCHAR2 (12)
CUSTOEMR_PHONE    VARCHAR2 (20)

Which statement finds the rows in the CUSTOMERS table that do not have a postal code


A.      SELECT customer_id, customer_name FROM customers WHERE postal_code CONTAINS NULL
B.      SELECT customer_id, customer name FROM customers WHERE posta_code='_______'
C.      SELECT customer_id, customer_name FROM customers WHERE postal_code IS NULL
D.     SELECT customer_id, customer_name FROM customers WHERE postal code IS NVL
E.      SELECT customer_id, customer_name FROM customers WHERE postal_code=NULL

170. You define a multiple-row subquery in the WHERE clause of an SQL query with a comparison operator"=" What happens when the main query is executed?

  1. the main query executes with the first value returned by the subquery
  2. the main query executes with the last value returned by the subquery
  3. the main query executes with all the values returned by the subquery
  4. The main query fails because the multiple-row subquery cannot be used with the comparison operator.
  5. You cannot define multiple-row subquery in the WHERE clause of a SQL query

171. Which three statements correctly describe the functions and use of constraints? (Choose three)

  1. constraints provide data independence
  2. constraint make complex queries easy
  3. constraints enforce rules at the view level
  4. constraints enforce rules at the table level
  5. constraints prevent the deletion of a table if there are dependencies
  6. constraints prevent the deletion of an index if there are dependencies

172. Which two are character manipulation functions? (Choose two)

A. TRIM
B. REPLACE
C. TRUNC
D. TO_DATE
 E. MOD
F. CASE

173. Examine the data in the EMPLOYEES table.
EMPLOYEES
EMPLOYEE_ID - EMP_NAME - DEPT_ID - MGR_ID - JOB_ID - SALARY

101 - Smith - 20 - 120 - SA_REP - 4000
102 - Martin - 10 - 105 - CLERK - 2500
103 - Chris - 20 - 120 - IT_ADMIN - 4200
104 - John - 30 - 108 - HR_CLERK - 2500
105 - Diana - 30 - 108 - IT_ADMIN - 5000
106 - Smith - 40 - 110 - AD.ASST - 3000
108 - Jennifer - 30 - 110 - HR_DIR – 6500
110 - Bob - 40 - *** - EK_DIR - 8000
120 - Ravi - 20 - 110 - SA_DIR - 6500

On the EMPLOYEES table,

EMPLOYEE_ID is the primary key.
MGR_ID is the ID of managers and refers to the EMPLOYEE_ID.
The JOB_ID column is a NOT NULL column.

Evaluate this DELETE statement: DELETE employee_id, salary, job_id FROM employees WHERE dept_id = 90; Why does the DELETE statement fail when you execute it?

  1. There is no row with dept_id 90 in the EMPLOYEES table.
  2. You cannot delete the JOB_ID column because it is a NOT NULL column.
  3. You cannot specify column names in the DELETE clause of the DELETE statement.
  4. You cannot delete the EMPLOYEE_ID column because it is the primary key of the table.

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

  1. a role can be given to a maximum of 1000 users
  2. a user can have access to a maximum of 10 roles
  3. A role can have a maximum of 100 privileges contained in it.
  4. Privileges are given to a role by using the CREATE ROLE statement.
  5. A role is a named group of related privileges that can be granted to the user
  6. A user can have access to several roles, and several users can be assigned the same role.

175. 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 number for the existing employee records

176. 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)
POSTE_CODE              VARCHAR2 (12)
CUSTOMER_PHONE    VARCHAR2 (20)

THE CUSTOMER_ID column is the primary key for the table which two statements find the number of customer? (Choose two.)

  1. SELECT TOTAL (*) FROM customers;
  2. SELECT COUNT (*) FROM customers;
  3. SELECT TOTAL (customer_id) FROM customer;
  4. SELECT COUNT(customer_id) FROM customer;
  5. SELECT COUNT(customers) FROM customers;
  6. SELECT TOTAL (customer_name) FROM customers;

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

  1. immediately after the SELECT clause
  2. before the WHERE clause
  3. before the FROM clause
  4. after the ORDER BY clause
  5. after the WHERE clause

178. For which two constrains does the Oracle Server implicitly create a unique index? (Choose two)

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

179. Which / SQL* Plus feature can be used to replace values in the where clause?

  1. Substitution variables
  2. replacement variables
  3. prompt variables
  4. instead-of variables
  5. This feature cannot be implemented through / SQL*Plus

180. Evaluate the SQL statement:

SELECT ROUND (TRUNC (MOD (1600, 10),-1), 2) FROM dual;
What will be displayed?

A. 0
B. 1
C. 0.00
D. an error statement

181. Examine the structure of the EMPLOYEES table:

EMPLOYEE_ID                         NUMBER                      Primary Key
FIRST_NAME                           VARCHAR2 (25)
LAST_NAME                            VARCHAR2 (25)
DEPARTMENT_ID                     NUMBER
SALARY                                   NUMBER

What is the correct syntax for an inline view?


A. SELECT a last_name, a salary, a department_id, b.maxsal FROM employees a,
(SELECT department_id, max (salary) maxsal FROM employees GROUP BY department_id)b WHERE a department_id = department-id AND a_salary

Answer: A

182. Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID                         NUMBER                      NOT NULL
EMP_ID                                    VARCHAR2 (30)
JOB_ID                                     VARCHAR2 (20)            DEFAULT 'SA_REP'
SAL                                          NUMBER
COMM_PCT                              NUMBER
MGR_ID                                    NUMBER
DEPARTMENT_ID                     NUMBER

You need to update the records of employees 103 and 115.
The UPDATE statement you specify should update the rows with the values specified below:
JOB_ID: Default value specified for this column definition
SAL: maximum salary earned for the job ID SA_REP
COMM_PCT: Default value is specified for the column, the value should be NULL
DEPARTMENT_ID: Supplied by the user during run time through substitution variable
Which UPDATE statement meets the requirements?

  1. UPDATE employees SET job_id=DEFAULT AND Sal=(SELECT MAX(sal) FROM employees WHERE job_id='SA_REP' AND comm_pct=DEFALUT AND department_id =&did WHERE employee_id IN (103, 115),
  2. UPDATE employees SET job_id = DEFAULT AND Sal = MAX(sal) AND comm_pct = DEFAULT OR NULL AND department _id = & did WHERE employee_id IN (103,115) AND job_id = 'SA_REP'
  3. UPDATE employees SET job_id = DEFAULT Sal = (SELECT MAX (sal) FROM employees WHERE job_id = 'SA_REP') comm_pct = DEFAULT, department _id = &did WHERE employee_id IN (103,115)
  4. UPDATE employees SET job_id = DEFAULT sal = MAX (sal) comm_pct = DEFAULT department_id = &did WHERE employee_id IN (103,115) AND job_id = 'SA_REP' E. UPDATE employees SET job_id = DEFAULT Sal = (SELECT MAX(sal) FROM employees WHERE job_id = 'SA_REP') comm_pct = DEFAULT OR NULL, department_id = &did WHERE employee_id IN (103,115)

183. Which data dictionary table should you query to view the object privileges granted to the user on specific columns?

  1. USER_TAB_PRIVS_MADE
  2. USER_TAB_PRIVS
  3. USER_COL_PRIVS_MADE
  4. USER_COL_PRIVS

184. Which three are DATETIME data types that can be used when specifying column definitions? (Choose three)

  1. TIMESTAMP
  2. INTERVAL MONTH TO DAY
  3. INTERVAL DAY TO SECOND
  4. INTERVAL YEAR TO MONTH
  5. TIMESTAMP WITH DATABASE TIMEZONE

185. Click the Exhibit button and examine the data from the ORDERS and CUSTOMERS tables.
ORDERS
ORD_ID - ORD_DATE - CUST_ID - ORD_TOTAL

100 - 12.JAN-2000 - 15 - 10000
101 - 09-MAR-2000 - 40 - 8000
102 - 09-MAR-2000 - 35 - 12500
103 - 15-MAR-2000 - 15 - 12000
104 - 25-JUN-2000 - 15 - 6000
105 - 18-JUL-2000 - 20 - 5000
106 - 18-JUL-2000 - 35 - 7000
107 - 21-JUL-2000 - 20 - 6500
108 - 04-AUG-2000 - 10 - 8000
CUSTOMERS
CUST_ID - CUST_NAME - CITY

10 - Smith - Los Angeles
15 - Bob - San Francisco
20 - Martin - Chicago
25 - Mary - New York
30 - Rina - Chicago
35 - Smith - New York
40 - Linda - New York

Evaluate the SQL statement:

SELECT * FROM orders WHERE cust_id = (SELECT cust_id FROM customers WHERE cust_name = 'Smith')

What is the result when the query is executed?


  1. ORD_ID ORD_DATE CUST_ID ORD_TOTAL 102 09-MAR-2000 35 12500 106 18-JUL-2000 35 7000 108 04-AUG-2000 10 8000
  2. ORD_ID ORD_DATE CUST_ID ORD_TOTAL 102 09-MAR-2000 35 12500 106 18-JUL-2000 35 7000
  3. ORD_ID ORD_DATE CUST_ID ORD_TOTAL 108 04-AUG-2000 10 8000
  4. The query fails because the subquery returns more than one row.
  5. The query fails because the outer query and the inner query are using different tables.

186. Which syntax turns an existing constraint on?

  1. ALTER TABLE table_name ENABLE constraint_name
  2. ALTER TABLE table_name STATUS = ENABLE CONSTRAINT constraint_name
  3. ALTER TABLE table_name ENABLE CONSTRAINT constraint_name
  4. ALTER TABLE table_name STATUS ENABLE CONSTRAINT constraint_name
  5. ALTER TABLE table_name TURN ON CONSTRAINT constraint_name
  6. ALTER TABLE table_name TURN ON CONSTRAINT constraint_name

187. Which two statements about views are true? (Choose two)

  1. A view can be created as read only
  2. A view can be created as a join on two or more tables.
  3. A view cannot have an ORDER BY clause in the SELECT statement.
  4. A view cannot be created with a GROUP BY clause in the SELECT statement.
  5. A view must have aliases defined for the column names in the SELECT statement.

188. the database administrator of your company created a public synonym called HR for the HUMAN_RESOURCES table of the GENERAL schema, because many users frequently use this table. As a user of the database, you created a table called HR in your schema. What happens when you execute this query?

SELECT * FROM HR;

  1. you obtain the results retrieved from the public synonym HR created by the database administrator
  2. You obtain the results retrieved form the HR table that belongs to your schema.
  3. you get an error message because you cannot retrieve from a table that has the same as a public synonym
  4. You obtain the results retrieved from both the public synonym HR and the HR table that belongs to your schema, as a Cartesian product.
  5. You obtain the results retrieved form both the public synonym HR and the HR table that belongs to your schema, as a FULL JOIN.

189. You need to give the MANAGER role the ability to select from insert into and modify existing rows in the STUDENT_GRADES table.

Anyone given this MANAGER role should be able to pass those privileges on to others. Which statement accomplishes this?

  1. GRANT select, insert, update ON student_grades TO manager;
  2. GRANT select, insert, update ON student_grades TO ROLE manager
  3. GRANT select, insert, modify ON student_grades TO manager WITH GRANT OPTION;
  4. GRANT select, insert, update ON student_grades TO manager WITH GRANT OPTION
  5. GRANT select, insert, update ON student_grades TO ROLE manager WITH GRANT OPTION;
  6. GRANT select, insert, modify ON student_grades TO ROLE manager WITH GRANT OPTION

No comments:

Post a Comment