Oracle 1Z0-051 - Estudo Dirigido: Name Null Type
Oracle 1Z0-051 - Estudo Dirigido: Name Null Type
Oracle 1Z0-051 - Estudo Dirigido: Name Null Type
1. Assume the tables EMPLOYEES and DEPARTMENT have to be joined using NATURAL JOIN. What is
the difference between the following two queries which follow? (Consider the table structures as given)
SQL> DESC employees
Name Null? Type
----------------------- -------- ----------------
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME NOT NULL VARCHAR2(25)
EMAIL NOT NULL VARCHAR2(25)
PHONE_NUMBER VARCHAR2(20)
HIRE_DATE NOT NULL DATE
JOB_ID NOT NULL VARCHAR2(10)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
SELECT *
FROM employees NATURAL JOIN departments
WHERE first_name = 'William'
AND last_name = 'Gietz';
SELECT *
FROM employees INNER JOIN departments
ON employees.DEPARTMENT_ID = departments.DEPARTMENT_ID
AND employees.MANAGER_ID = departments.MANAGER_ID
WHERE first_name = 'William'
AND last_name = 'Gietz';
A. There is no difference
B. The result is different in both the cases
C. Both the queries will give an ORA error on execution
D. None of the above
A. NULL
B. 1
C. 0
D. Gives an error because NULL cannot be explicitly specified to NVL function
A. 78945*****
B. **78945.45
C. The function RPAD cannot be nested with other functions
D. 78945.45****
8. Which of the following functions are used to differentiate between even or odd numbers in Oracle DB?
A. ROUND
B. TRUNC
C. MOD
D. REPLACE
Examine the structure of the EMPLOYEES table as given and answer the questions 10 to 12 that follow.
SQL> DESC employees
Name Null? Type
----------------------- -------- ----------------
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME NOT NULL VARCHAR2(25)
EMAIL NOT NULL VARCHAR2(25)
PHONE_NUMBER VARCHAR2(20)
HIRE_DATE NOT NULL DATE
JOB_ID NOT NULL VARCHAR2(10)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
10. Which of the following queries will give the same result as given in the query given below?
SELECT CONCAT(first_name, last_name) FROM employees;
12. Assuming the last names of the employees are in a proper case in the table employees, what will be the
outcome of the following query?
SELECT employee_id, last_name, department_id FROM employees WHERE last_name =
'smith';
A. It will display the details of the employee with the last name as Smith
B. It will give no result.
C. It will give the details for the employee having the last name as 'Smith' in all Lower case.
D. It will give the details for the employee having the last name as 'Smith' in all INITCAP case.
You need to display the last name of all employees which starts with the letter 'A'. Which of the following
queries will yield the required result?
A. SELECT first_name, last_name, salary FROM employees WHERE salary > (SELECT salary FROM
employees WHERE job_id = 'VICE-PRESIDENT');
B. SELECT first_name, last_name, salary FROM employees WHERE salary = (SELECT salary FROM
Employees WHERE job_id = 'VICE-PRESIDENT');
C. SELECT first_name, last_name, salary FROM employees WHERE job_id = 'VICE-PRESIDENT');
D. None of the above
15. What will be the outcome of the following query? (Consider the given table structure)
SQL> DESC employees
Name Null? Type
----------------------- -------- ----------------
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME NOT NULL VARCHAR2(25)
EMAIL NOT NULL VARCHAR2(25)
PHONE_NUMBER VARCHAR2(20)
HIRE_DATE NOT NULL DATE
JOB_ID NOT NULL VARCHAR2(10)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
16. You need to find out the names of all employees who belong to the same department as the
employee 'Jessica Butcher' who is in department 100 and has an employee ID 40. Which of the
following queries will be correct?
A. SELECT first_name, last_name FROM employees WHERE last_name = 'Butcher' And
first_name = 'Jessica';
B. SELECT first_name, last_name FROM employees WHERE dept_id=100;
C. SELECT first_name, last_name FROM employees WHERE dept_id = (SELECT dept_id
FROM employees WHERE first_name = 'Jessica' AND last_name = 'Butcher');
D. SELECT first_name, last_name FROM employees WHERE department = (SELECT
dept_id FROM employees WHERE first_name = 'Jessica' AND last_name = 'Butcher'
AND dept_id = 100 AND emp_id = 40);
17. You need to find out the employees, which belong to the department of 'Jessica Butcher' and have salary
greater than the salary of 'Jessica Butcher' who has an employee ID of 40. Which of the following queries
will work?
19. Consider two statements about outer and inner queries in context of SQL sub-queries?
i. The inner queries can get data from only one table
ii. The inner queries can get data from more than one table
A. (i)
B. (ii)
C. Both (i) and (ii)
D. Neither (i) nor (ii)
Examine the table structure as given. Consider the query given below and answer the questions 20 to 22 that
follow:
SQL> DESC employees
Name Null? Type
----------------------- -------- ----------------
EMPLOYEE_ID NOT NULL NUMBER(6)
FIRST_NAME VARCHAR2(20)
LAST_NAME NOT NULL VARCHAR2(25)
EMAIL NOT NULL VARCHAR2(25)
PHONE_NUMBER VARCHAR2(20)
HIRE_DATE NOT NULL DATE
JOB_ID NOT NULL VARCHAR2(10)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
20. What will be the outcome of the query given above if the < ANY operator is replaced with = ANY
operator?
A. Oracle will treat each value of the salary returned from the sub-query as it does with IN operator
B. There will be no difference in the results
C. The results will differ
D. The execution will thrown an ORA error
22. Assume that the < ANY operator is replaced with the > ANY. What is true about this operator?
A. It gives the maximum salary
B. It finds only the maximum salary from the sub-query
C. It gives more than the minimum salary
D. It gives the minimum salary
23. Which of the following can create a view even if the base table(s) does not exist?
A. NOFORCE
B. FORCE
C. OR REPLACE
D. CREATE VIEW
24. Suppose you need to change the start value of this sequence to 1000. Which of the following statements
will help?
A. ALTER dept_deptid_seq INCREMENT BY 100 START WITH 1000 MAXVALUE 9999 NOCACHE
NOCYCLE;
B. The sequence has to be dropped and re-created to start the sequence from 1000.
C. ALTER SEQUENCE dept_deptid_seq START WITH 101
D. ALTER SEQUENCE dept_deptid_seq INCREMENT BY 100 START WITH 101 CYCLE;
25. What is true with respect to accessing the below view? (Assume the table structure given)
A. The view has to be accessed by the original column names defined in the base table
B. The view has to be accessed by the aliases given in the view query
C. View is a simple view
D. None of the above
26. What is true with respect to accessing the below view? (Assume the table structure given)
A. It is not mandatory that the number of aliases match the no. of expressions in the sub-query
B. It is mandatory that the no. of aliases listed must match the no. of expressions selected in the sub-query
C. It is mandatory to give aliases while creating a view
D. None of the above
27. The JOB_HISTORY table is owned by a user "Andy". Andy grants the SELECT privilege on the
JOB_HISTORY table to another user "HR". Which statement would create a synonym EMP_JOBS so that
"HR" can execute the following query successfully? (Assume the structure of tables as given)
A. Andy issues -
B. HR issues -
C. HR issues -
28. Which keyword can assure that the DML operations performed on the view stay in the domain of the
view?
A. OR REPLACE
B. CREATE
C. WITH CHECK OPTION
D. None of the above
Consider the following table structure and the given statement and answer the questions 30 and 31
that follow:
UPDATE empvu100
Set department_id = 200
Where employee_id = 121;
31. Consider the following query and answer the following query. Assume that the EMPLOYEE_ID ,
DEPARTMENT_ID and FIRST_NAME columns of EMPLOYEES table are indexed. (Assume the table
structure as given)
Will the existing indexes help in this case if there are 1 million rows in the table EMPLOYEES?
A. Yes
B. No
C. It might help
D. None of the above
33. Which of the following privileges will allow you to drop a sequence? (Choose the most appropriate
answer)
A. ALTER SEQUENCE
B. ALTER TABLE
C. DROP SEQUENCE
D. DROP ANY SEQUENCE
34. The following query for the sequence EMP_EMPID_SEQ is executed after a transaction, which inserted
five employee details.
Suppose the employee transaction rolled back. What will be the result of the above query?
36. What value will the TO_CHAR (number/date, [format], [nlsparameters]) use if the [nlsparameters]
parameter is omitted?
A. It throws an ORA error
B. The [nlsparameters] parameter is mandatory and it can't be omitted.
C. It will use the default parameter values for the session.
D. It will use the default parameter values set during the database design.
A. 01-JAN-13
B. 01-01-2013
C. An ORA error
D. 1-JAN-13
A. It will return an ORA error because of the use of double quotes in the Date format
B. 1st January 2013
C. First of JANUARY 2013 12:00:00 AM
D. First of January 2013 12:00:00 AM
39. Assuming the SYSDATE is 01-JAN-13, what will be the outcome of the following query?
A. 1st of January
B. 1st
C. 1 ST
D. 01ST
40. Assuming the SYSDATE is 01-JAN-13, what will be the outcome of the following query?
A. 1st of January
B. 1st
C. 1ST
D. 01ST
A. $3,000,000.67
B. 3000,000.67
C. 3000.67
D. ORA error as the format model has lesser characters than the input string. It should be the same.
DECODE(expr1,comp1,iftrue1,comp2,[iftrue2])
44. Which of the following SELECT statements lists the highest retail price of all books in the Family
category?
A. SELECT MAX(retail) FROM books WHERE category = 'FAMILY';
B. SELECT MAX(retail) FROM books HAVING category = 'FAMILY';
C. SELECT retail FROM books WHERE category = 'FAMILY' HAVING MAX(retail);
D. None of the above
SELECT department_id
FROM employees WHERE hiredate > '01-JAN-1985' AND COUNT(*) > 2
GROUP by department_id
HAVING SUM (salary ) > 1000;
SELECT lower(job),avg(salary )
FROM employees
GROUP BY upper(job);
48. You need to create a table with the following column specifications:
Employee ID (numeric data type) for each employee. The company will have over 10,000 employees
by 2020;
Employee Name (character data type) that stores the employee name;
Hire date, which stores the date of joining the organization for each employee;
Status (character data type), that contains the cvalue 'ACTIVE' if no data is entered;
Resume (character large object data type), which contains the resume submitted by the employee.
49. You need to extract details of those products in the SALES table where the PROD_ID column contains
the string ‘D_123’. Which WHERE clause could be used in the SELECT command to get the required
output?:
A. WHERE prod_id LIKE ‘%_D123%’ ESPACE ‘_’
B. WHERE prod_id LIKE ‘%D\_123%’ ESPACE ‘\’
C. WHERE prod_id LIKE ‘%_D123%’ ESPACE ‘%_’
D. WHERE prod_id LIKE ‘%D_123%’ ESPACE ‘_’
50. The AT TIME ZONE expression cannot be used to convert which of the following datatypes?
A. DATE
B. TIMSETAMP
C. TIMSETAMP WITH TIME ZONE
D. TIMSETAMP WITH LOCAL TIME ZONE
52. A function used to convert data into values of the datatype TIMESTAMP WITH LOCAL TIME ZONE is:
A. CAST
B. FROM_TZ
C. TO_TIMESTAMP_TZ
D. SYS_EXTRACT_UTC
UPDATE INSTRUCTORS SET EXEMPT = 'YES', VACATION = 15 WHERE PAY_RATE > 20;
A. No records will be updated;
B. One record will be updated;
C. Two records will be updated;
D. At least one of the statements will not execute.
Which of the following DELETE statements will delete the second of theses two rows? (Choose two).
57. Examine the illustration. You are tasked to produce a report that shows the number of students at each
campus, in each status Which of the following queries successfully performs the task ?
60.