Section 1 Quiz - Oracle
Section 1 Quiz - Oracle
Section 1 Quiz - Oracle
4. A Relational Database generally contains two or more tables. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
5. Columns in a database table contain data with the same _________: Mark for Review
(1) Points
Type (*)
Row
Field
Key
—————————\
Section 1 Quiz
(Answer all questions in this section)
6. Which statement best describes how arithmetic expressions are handled? Mark for Review
(1) Points
Multiplication and addition operations are handled before subtraction and division operations.
Multiplication and subtraction operations are handled before any other operations.
Division and multiplication operations are handled before subtraction and addition operations. (*)
Addition operations are handled before any other operations.
Correct Correct.
7. You query the database with this SQL statement:
SELECT *
FROM transaction
WHERE product_id = 4569;
Which SQL SELECT statement capabilities are achieved when this statement is executed?
Mark for Review
(1) Points
Projection, selection and joining
Projection only
Selection only
Selection and projection only (*)
Incorrect Incorrect. See Section 1 Lesson 3.
8. SELECT * FROM departments; is a: Mark for Review
(1) Points
Strategy
Statement (*)
Keyword
Declaration
Correct Correct
9. The order of operator precedence is Mark for Review
(1) Points
/+–*
*–+/
* / + – (*)
None of the above
Correct Correct
10. The SQL SELECT statement is capable of: Mark for Review
(1) Points
Selection and protection
Selection and projection (*)
Projection and updating
None of the above
Correct Correct
—————-
Section 1 Quiz
(Answer all questions in this section)
11. The _______ clause can be added to a SELECT statement to return a subset of the data. Mark for
Review
(1) Points
EVERY
ANYWHERE
WHERE (*)
WHICH
Correct Correct.
12. All computers in the world speak the same languages, so you only need to learn one
programming language – Oracle SQL. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct.
13. What command do you use to add rows to a table Mark for Review
(1) Points
NEW_ROW
INSERT (*)
ADD_ROW
ADD
Correct Correct
14. Examine the follolowing SELECT statement.
SELECT *
FROM employees;
This statement will retrieve all the rows in the employees table. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
15. The DESCRIBE command returns all rows from a table. True or False? Mark for Review
(1) Points
True
False (*)
Section 2
1.You need to display employees with salaries that are at least 30000 or higher. Which comparison
operator should you use? Mark for Review
(1) Points
“=>”
>= (*)
>
!=
2. When using the LIKE condition, which symbol represents any sequence of characters of any
length–zero, one, or more characters? Mark for Review
(1) Points
#
&
% (*)
3. Which comparison operator searches for a specified character pattern? Mark for Review
(1) Points
IN
BETWEEN…AND…
IS NULL
LIKE (*)
Correct Correct.
4. What does the DISTINCT keyword do when it is used in a SELECT clause? Mark for Review
(1) Points
Hides NULL values
Eliminates only unique rows in the result
Eliminates all unique values and compares values
Eliminates duplicate rows in the result (*)
Correct Correct.
5. You need to display all the rows in the EMPLOYEES table that contain a null value in the
DEPARTMENT_ID column. Which comparison operator should you use? Mark for Review
(1) Points
ISNULL
IS NULL (*)
NULL!
“= NULL”
Correct Correct.
====================================================
6. The PLAYERS table contains these columns:
PLAYER_ID NUMBER(9)
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2 (20)
TEAM_ID NUMBER (4)
MANAGER_ID NUMBER (9)
POSITION_ID NUMBER (4)
Which SELECT statement should you use if you want to display unique combinations of the TEAM_ID
and MANAGER_ID columns?
Mark for Review
(1) Points
SELECT * FROM players;
SELECT DISTINCT team_id, manager_id FROM players; (*)
SELECT team_id, manager_id FROM players;
SELECT team_id, DISTINCT manager_id FROM players;
SELECT team_id, manager_id DISTINCT FROM players;
Incorrect Incorrect. See Section 2 Lesson 2.
7. Which SELECT statement will display both unique and non-unique combinations of the
MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table? Mark for Review
(1) Points
SELECT DISTINCT manager_id, department_id FROM employees;
SELECT manager_id, department_id DISTINCT FROM employees;
SELECT manager_id, DISTINCT department_id FROM employees;
SELECT manager_id, department_id FROM employees; (*)
Incorrect Incorrect. See Section 2 Lesson 2.
8. What will be the result of the SELECT statement and what will display?
SELECT last_name, salary, salary + 300
FROM employees;
Mark for Review
(1) Points
Display the last name, salary, and the results of adding 300 to the salary of the first employee row
Display the last name, salary, and the results of adding 300 to each salary for all the employees (*)
Display the last name and salary of all employees who have a salary greater than 300.
Modify the salary column by adding 300 and only display the last name and the new salary.
Correct Correct.
9. Which example would limit the number of rows returned? Mark for Review
(1) Points
SELECT title FROM d_songs WHERE type_code = 88; (*)
SELECT title FROM d_songs WHERE type_code = = 88;
SELECT title FROM d_songs WHEN type_code = = 88;
SELECT title FROM d_songs WHEN type_code = 88;
Correct Correct
10. To restrict the rows returned from an SQL Query, you should use the _____ clause: Mark for
Review
(1) Points
SELECT
WHERE (*)
GROUP BY
CONDITION
All of the Above
Incorrect Incorrect. See Section 2 Lesson 2.
======================================================
The EMPLOYEES table includes these columns:
EMPLOYEE_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(15) NOT NULL
FIRST_NAME VARCHAR2(10) NOT NULL
HIRE_DATE DATE NOT NULL
You want to produce a report that provides the last names, first names, and hire dates of those
employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you
issue to accomplish this task?
Mark for Review
(1) Points
SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN ’01-Mar-2000′ AND ’30-Aug-2000′;
(*)
SELECT last_name, first_name, hire_date
FROM employees
GROUP BY hire_date >= ’01-Mar-2000′ and hire_date <= ’30- Aug-2000′;
SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN ’30-Aug-2000′ AND ’01-Mar-2000′;
SELECT last_name, first_name, hire_date
FROM employees
AND hire_date >= ’01-Mar-2000′ and hire_date <= ’30-Aug-2000′;
Correct Correct.
12. Which two statements would select salaries that are greater than or equal to 2500 and less than
or equal to 3500? (Choose two) Mark for Review
(1) Points
(Choose all correct answers)
WHERE salary >= 2500 AND salary <= 3500 (*)
WHERE salary <=2500 AND salary >= 3500
WHERE salary BETWEEN 3500 AND 2500
WHERE salary BETWEEN 2500 AND 3500 (*)
Incorrect Incorrect. See Section 2 Lesson 3.
13. The EMPLOYEES table contains these columns:
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)
You are writing a SELECT statement to retrieve the names of employees that have an email address.
SELECT last_name||’, ‘||first_name “Employee Name”
FROM employees;
Which WHERE clause should you use to complete this statement?
Mark for Review
(1) Points
WHERE email = NULL;
WHERE email IS NOT NULL; (*)
WHERE email != NULL;
WHERE email IS NULL;
Incorrect Incorrect. See Section 2 Lesson 3.
14. When using the “LIKE” operator, the % and _ symbols can be used to do a pattern-matching, wild
card search. True or False? Mark for Review
(1) Points
True (*)
False
Incorrect Incorrect. See Section 2 Lesson 3.
15. Which of the following WHERE clauses would not select the number 10? Mark for Review
(1) Points
WHERE hours <= 10
WHERE hours BETWEEN 10 AND 20
WHERE hours <>10 (*)
WHERE hours IN (8,9,10)
Section 2 Quiz
(Answer all questions in this section)
1. Which of the following is true? Mark for Review
(1) Points
Date values are enclosed in single quotation marks (*)
Character strings must be enclosed in double quotation marks
Date values are not format-sensitive
Character values are not case-sensitive
Incorrect Incorrect. See Section 2 Lesson 2.
2. You want to retrieve a list of customers whose last names begin with the letters ‘Fr’ . Which keyword should
you include in the WHERE clause of your SELECT statement to achieve the desired result? Mark for Review
(1) Points
LIKE (*)
BETWEEN
AND
IN
Correct Correct.
3. You need to display all the values in the EMAIL column that contains the underscore (_) character as part of
that email address. The WHERE clause in your SELECT statement contains the LIKE operator. What must you
include in the LIKE operator? Mark for Review
(1) Points
A percent sign (%)
The ESCAPE option (\)
The ESCAPE option (\) and one or more percent signs (%) (*)
The (+) operator
Incorrect Incorrect. See Section 2 Lesson 2.
4. Which example would limit the number of rows returned? Mark for Review
(1) Points
SELECT title FROM d_songs WHEN type_code = = 88;
SELECT title FROM d_songs WHEN type_code = 88;
SELECT title FROM d_songs WHERE type_code = 88; (*)
SELECT title FROM d_songs WHERE type_code = = 88;
Correct Correct
5. You need to display all the employees whose last names (of any length) start with the letters ‘Sm’ . Which
WHERE clause should you use? Mark for Review
(1) Points
WHERE last_name LIKE ‘%Sm’
WHERE last_name LIKE ‘_Sm’
WHERE last_name LIKE ‘Sm_’
WHERE last_name LIKE ‘Sm%’ (*)
Incorrect Incorrect. See Section 2 Lesson 2.
Page 1 of 3 Next Summary
=======
Section 2 Quiz
(Answer all questions in this section)
6. The following is a valid SQL SELECT statement. True or False?
SELECT first_name || ‘ ‘ || last_name alias AS Employee_Name
FROM employees:
Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. See Section 2 Lesson 1.
7. When using the LIKE condition to search for _ symbols, which character can you use as the default ESCAPE
option? Mark for Review
(1) Points
%
\ (*)
&
^
Incorrect Incorrect. See Section 2 Lesson 1.
8. The Concatenation Operator does which of the following? Mark for Review
(1) Points
Links rows of data together inside the database.
Separates columns.
Is represented by the asterisk (*) symbol
Links two or more columns or literals to form a single output column (*)
Incorrect Incorrect. See Section 2 Lesson 1.
9. When using the LIKE condition, which symbol represents any sequence of characters of any length–zero,
one, or more characters? Mark for Review
(1) Points
% (*)
#
_
&
Correct Correct.
10. Which of the following is NOT BEING DONE in this SQL statement?
SELECT first_name || ‘ ‘ || last_name “Name”
FROM employees;
Mark for Review
(1) Points
Selecting columns from the employees table
Concatenating first name, middle name and last name (*)
Using a column alias
Putting a space between first name and last name
Incorrect Incorrect. See Section 2 Lesson 1.
Previous Page 2 of 3 Next Summary
===========
Section 2 Quiz
(Answer all questions in this section)
11. The EMPLOYEES table includes these columns:
EMPLOYEE_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(15) NOT NULL
FIRST_NAME VARCHAR2(10) NOT NULL
HIRE_DATE DATE NOT NULL
You want to produce a report that provides the last names, first names, and hire dates of those employees who
were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this
task?
Mark for Review
(1) Points
SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN ’01-Mar-2000′ AND ’30-Aug-2000′;
(*)
SELECT last_name, first_name, hire_date
FROM employees
GROUP BY hire_date >= ’01-Mar-2000′ and hire_date <= ’30- Aug-2000′;
SELECT last_name, first_name, hire_date
FROM employees
AND hire_date >= ’01-Mar-2000′ and hire_date <= ’30-Aug-2000′;
SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN ’30-Aug-2000′ AND ’01-Mar-2000′;
Incorrect Incorrect. See Section 2 Lesson 3.
12. The EMPLOYEES table contains these columns:
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)
You are writing a SELECT statement to retrieve the names of employees that have an email address.
SELECT last_name||’, ‘||first_name “Employee Name”
FROM employees;
Which WHERE clause should you use to complete this statement?
Mark for Review
(1) Points
WHERE email = NULL;
WHERE email IS NOT NULL; (*)
WHERE email != NULL;
WHERE email IS NULL;
Correct Correct.
13. Which two statements would select salaries that are greater than or equal to 2500 and less than or equal to
3500? (Choose two) Mark for Review
(1) Points
(Choose all correct answers)
WHERE salary <=2500 AND salary >= 3500
WHERE salary BETWEEN 3500 AND 2500
WHERE salary BETWEEN 2500 AND 3500 (*)
WHERE salary >= 2500 AND salary <= 3500 (*)
Incorrect Incorrect. See Section 2 Lesson 3.
14. Which of the following WHERE clauses would not select the number 10? Mark for Review
(1) Points
WHERE hours <>10 (*)
WHERE hours BETWEEN 10 AND 20
WHERE hours IN (8,9,10)
WHERE hours <= 10
Incorrect Incorrect. See Section 2 Lesson 3.
15. Which of the following are examples of comparison operators used in the WHERE clause? Mark for Review
(1) Points
=, >, <, <=, >=, <>
between ___ and ___
in (..,..,.. )
like
is null
All of the above (*)
Section 2 Quiz
(Answer all questions in this section)
1. Which of the following would be returned by this SELECT statement:
SELECT last_name, salary
FROM employees
WHERE salary < 3500;
Mark for Review
(1) Points
LAST_NAME SALARY
King 5000
LAST_NAME SALARY
Rajas 3500
LAST_NAME SALARY
Davies 3100
(*)
All of the above
Incorrect Incorrect. See Section 2 Lesson 2.
2. You want to retrieve a list of customers whose last names begin with the letters ‘Fr’ . Which
symbol should you include in the WHERE clause of your SELECT statement to achieve the desired
result? Mark for Review
(1) Points
#
*
% (*)
~
Correct Correct.
3. You need to display all the employees whose last names (of any length) start with the letters ‘Sm’ .
Which WHERE clause should you use? Mark for Review
(1) Points
WHERE last_name LIKE ‘_Sm’
WHERE last_name LIKE ‘%Sm’
WHERE last_name LIKE ‘Sm_’
WHERE last_name LIKE ‘Sm%’ (*)
Correct Correct.
4. You need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the
DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the
DEPARTMENT_ID column to this specific list of values? Mark for Review
(1) Points
!=
IN (*)
=
BETWEEN..AND..
Correct Correct.
5. Which of the following are true? (Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
Date values are format-sensitive (*)
Character values are not case-sensitive
Character strings are enclosed in double quotation marks
Date values are enclosed in single quotation marks (*)
Incorrect Incorrect. See Section 2 Lesson 2.Section 2 Quiz
(Answer all questions in this section)
6. When using the “LIKE” operator, the % and _ symbols can be used to do a pattern-matching, wild
card search. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
7. The EMPLOYEES table contains these columns:
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
EMAIL VARCHAR2(50)
You are writing a SELECT statement to retrieve the names of employees that have an email address.
SELECT last_name||’, ‘||first_name “Employee Name”
FROM employees;
Which WHERE clause should you use to complete this statement?
Mark for Review
(1) Points
WHERE email IS NOT NULL; (*)
WHERE email = NULL;
WHERE email IS NULL;
WHERE email != NULL;
Correct Correct.
8. If you write queries using the BETWEEN operator, it does not matter in what order you enter the
values, i.e. BETWEEN low value AND high value will give the same result as BETWEEN high value and
low value. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct.
9. The EMPLOYEES table includes these columns:
EMPLOYEE_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(15) NOT NULL
FIRST_NAME VARCHAR2(10) NOT NULL
HIRE_DATE DATE NOT NULL
You want to produce a report that provides the last names, first names, and hire dates of those
employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you
issue to accomplish this task?
Mark for Review
(1) Points
SELECT last_name, first_name, hire_date
FROM employees
AND hire_date >= ’01-Mar-2000′ and hire_date <= ’30-Aug-2000′;
SELECT last_name, first_name, hire_date
FROM employees
GROUP BY hire_date >= ’01-Mar-2000′ and hire_date <= ’30- Aug-2000′;
SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN ’30-Aug-2000′ AND ’01-Mar-2000′;
SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN ’01-Mar-2000′ AND ’30-Aug-2000’;
(*)
Correct Correct.
10. Which two statements would select salaries that are greater than or equal to 2500 and less than
or equal to 3500? (Choose two) Mark for Review
(1) Points
(Choose all correct answers)
WHERE salary BETWEEN 3500 AND 2500
WHERE salary >= 2500 AND salary <= 3500 (*)
WHERE salary BETWEEN 2500 AND 3500 (*)
WHERE salary <=2500 AND salary >= 3500
Correct Correct
===
Section 2 Quiz
(Answer all questions in this section)
11. Which clause would you include in a SELECT statement to restrict the data returned to only the
employees in department 10? Mark for Review
(1) Points
FROM
IS
SELECT
WHERE (*)
Correct Correct.
12. The Concatenation Operator does which of the following? Mark for Review
(1) Points
Links two or more columns or literals to form a single output column (*)
Links rows of data together inside the database.
Is represented by the asterisk (*) symbol
Separates columns.
Correct Correct.
13. You need to display employees whose salary is in the range of 10000 through 25000 for
employees in department 50 . What does the WHERE clause look like? Mark for Review
(1) Points
WHERE department_id = 50
AND salary BETWEEN 10000 AND 25000
(*)
WHERE department_id = 50
AND salary BETWEEN 25001 AND 10001
WHERE department_id < 50
AND salary BETWEEN 10000 AND 25000
WHERE department_id > 50
AND salary BETWEEN 10000 AND 25000
Incorrect Incorrect. See Section 2 Lesson 1.
14. You need to combine the FIRST_NAME and LAST_NAME columns in the EMPLOYEES table and
display the columns as a combined character string. Which operator should you use? Mark for
Review
(1) Points
|| (*)
+
AND
|
Correct Correct.
15. When using the LIKE condition to search for _ symbols, which character can you use as the
default ESCAPE option? Mark for Review
(1) Points
&
\ (*)
^
%
Section 4 Quiz
(Answer all questions in this section)
1. Which character manipulation function always returns a numerical value? Mark for Review
(1) Points
TRIM
SUBSTR
LENGTH (*)
LPAD
Correct Correct
2. Which of the following are types of SQL functions? (Choose two correct answers.) Mark for Review
(1) Points
(Choose all correct answers)
Column-Row Functions
Single-Row Functions (*)
Multi-Row Functions (*)
Many-to-Many Functions
Incorrect Incorrect. Refer to Section 4 Lesson 1.
3. Which SQL function can be used to remove heading or trailing characters (or both) from a
character string? Mark for Review
(1) Points
LPAD
CUT
TRIM (*)
NVL2
Correct Correct
4. What will the following SQL statemtent display?
SELECT last_name, LPAD(salary, 15, ‘$’)SALARY
FROM employees;
Mark for Review
(1) Points
The last name and the format of the salary limited to 15 digits to the left of the decimal and the
column labeled SALARY.
The last name and salary for all employees with the format of the salary 15 characters long, left-
padded with the $ and the column labeled SALARY. (*)
The query will result in an error: “ORA-00923: FROM keyword not found where expected.”
The last name of employees that have a salary that includes a $ in the value, size of 15 and the
column labeled SALARY.
Correct Correct
5. Which SQL function is used to return the position where a specific character string begins within a
larger character string? Mark for Review
(1) Points
CONCAT
LENGTH
INSTR (*)
SUBSTR
Correct Correct
======
Section 4 Quiz
(Answer all questions in this section)
6. What is the result of the following SQL Statement:
SELECT ROUND(45.923,-1)
FROM DUAL; Mark for Review
(1) Points
46
45.9
50 (*)
None of the above
Correct Correct
7. You issue this SQL statement:
SELECT TRUNC(751.367,-1) FROM dual;
Which value does this statement display?
Mark for Review
(1) Points
750 (*)
751
700
751.3
Incorrect Incorrect. Refer to Section 4 Lesson 2.
8. Which number function may be used to determine if a value is odd or even? Mark for Review
(1) Points
TRUNC
ROUND
BINARY
MOD (*)
Correct Correct
9. Which comparison operator retrieves a list of values? Mark for Review
(1) Points
BETWEEN IN
IN (*)
LIKE
IS NULL
Correct Correct
10. You issue this SQL statement:
SELECT ROUND (1282.248, -2) FROM dual;
What value does this statement produce?
Mark for Review
(1) Points
1282.25
1300 (*)
1200
1282
Incorrect Incorrect. Refer to Section 4 Le
=====
view your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 4 Quiz
(Answer all questions in this section)
11. Which query would return a whole number if the sysdate is 26-May-2004? Mark for Review
(1) Points
SELECT TRUNC(MONTHS_BETWEEN(SYSDATE,’19-Mar-1979′) /12)
AS YEARS
FROM DUAL;
(*)
SELECT TRUNC(YEARS_BETWEEN(SYSDATE,’19-Mar-1979′) /12)
AS YEARS
FROM DUAL;
SELECT MONTHS_BETWEEN(SYSDATE,’19-Mar-1979′) /12
AS YEARS
FROM DUAL;
None of the above
Correct Correct
12. Which of the following SQL statements will correctly display the last name and the number of
weeks employed for all employees in department 90? Mark for Review
(1) Points
SELECT last_name, # of WEEKS
FROM employees
WHERE department_id = 90;
SELECT last_name, (SYSDATE-hire_date)/7 AS WEEKS
FROM employees
WHERE department_id = 90;
(*)
SELECT last name, (SYSDATE-hire_date)/7 DISPLAY WEEKS
FROM employees
WHERE department id = 90;
SELECT last_name, (SYSDATE-hire_date)AS WEEK
FROM employees
WHERE department_id = 90;
Correct Correct
13. Which SELECT statement will return a numeric value? Mark for Review
(1) Points
SELECT ROUND(hire_date, DAY)
FROM employees;
SELECT SYSDATE – 7
FROM employees;
SELECT (SYSDATE – hire_date) / 7
FROM employees;
(*)
SELECT SYSDATE + 600 / 24
FROM employees;
Correct Correct
14. What function would you use to return the highest date in a month? Mark for Review
(1) Points
HIGHEST_DAY
END_DAY
LAST_DAY (*)
FINAL_DAY
Correct Correct
15. What is the result of the following query?
SELECT ADD_YEARS (’11-Jan-1994′,6)
FROM dual; Mark for Review
(1) Points
11-Jan-2000
11-Jul-2000
This in not a valid SQL statement. (*)
11-Jul-1995
Section 3 Quiz
(Answer all questions in this section)
1. Which of the following statements best describes the rules of precedence when using SQL? Mark
for Review
(1) Points
The order in which the columns are displayed
The order in which the expressions are sorted
The order in which the operators are returned
The order in which the expressions are evaluated and calculated (*)
All of the above
Correct Correct
2. Which of the following are TRUE regarding the logical AND operator? Mark for Review
(1) Points
TRUE AND FALSE return TRUE
TRUE AND TRUE return FALSE
FALSE AND TRUE return NULL
TRUE AND FALSE return FALSE (*)
Correct Correct.
3. Which of the following are examples of logical operators that might be used in a WHERE clause.
(Choose Two) Mark for Review
(1) Points
(Choose all correct answers)
AND, OR (*)
< >, =, <=, >=, <>
NOT (*)
LIKES
All of the above
Correct Correct
4. Which of the following would be returned by this SQL statement:
SELECT First_name, last_name, department_id
FROM employees
WHERE department_id IN(50,80)
AND first_name LIKE ‘ C% ‘
OR last_name LIKE ‘ %s% ‘
Mark for Review
(1) Points
FIRST_NAME LAST_NAME DEPARTMENT_ID
Shelly Higgins 110
FIRST_NAME LAST_NAME DEPARTMENT_ID
Curtis Davies 50
FIRST_NAME LAST_NAME DEPARTMENT_ID
Randall Matos 50
FIRST_NAME LAST_NAME DEPARTMENT_ID
Michael Hartstein 20
All of the above (*)
Correct Correct
5. Which logical operator returns TRUE if either condition is true? Mark for Review
(1) Points
OR (*)
NOT
AND
BOTH
Correct Correct.
====Section 3 Quiz
(Answer all questions in this section)
6. The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(9) PK
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER(9)
Compare these two SQL statements:
1.
SELECT DISTINCT department_id DEPT, last_name, first_name
FROM employees
ORDER BY department_id;
2.
SELECT department_id DEPT, last_name, first_name
FROM employees
ORDER BY DEPT;
How will the results differ?
Mark for Review
(1) Points
One of the statements will return a syntax error.
There is no difference in the result between the two statements.
One of the statements will eliminate all duplicate DEPARTMENT_ID values.
The statements will sort on different column values. (*)
Correct Correct.
7. The following statement represents a multi-row function. True or False?
SELECT UPPER(last_name)
FROM employees;
Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect! See Section 3 Lesson 3.
8. Will the following statement return one row?
SELECT MAX(salary), MIN(Salary), AVG(SALARY)
FROM employees;
Mark for Review
(1) Points
Yes, it will return the highest salary from each employee.
Yes, it will return the average salary from the employees table.
Yes, it will return the highest salary, the lowest salary, and the average salary from all employees. (*)
No, it is illegal. You cannot use more than one multi-row function in a SELECT statement.
Correct Correct
9. The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
You must display the player name, team id, and salary for players whose salary is in the range from
25000 through 100000 and whose team id is in the range of 1200 through 1500. The results must be
sorted by team id from lowest to highest and then further sorted by salary from highest to lowest.
Which statement should you use to display the desired result?
Mark for Review
(1) Points
SELECT last_name, first_name, team_id, salary
FROM players
WHERE (salary > 25000 OR salary < 100000)
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary;
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary DESC;
(*)
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary > 24999.99 AND salary < 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id ASC, salary DESC;
SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary BETWEEN 24999.99 AND 100000.01
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id DESC, salary DESC;
Correct Correct.
10. The conversion function TO_CHAR is a single row function. True or False? Mark for Review
(1) Points
True (*)
False
==========
Section 3 Quiz
(Answer all questions in this section)
11. A column alias can be specified in an ORDER BY Clause. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
12. Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statement?
Mark for Review
(1) Points
BETWEEN AND …
AND
IN (*)
LIKE
Incorrect Incorrect! See Section 3 Lesson 2.
13. What value will the following SQL statement return?
SELECT employee_id
FROM employees
WHERE employee_id BETWEEN 100 AND 150
OR employee_id IN(119, 175, 205)
AND (employee_id BETWEEN 150 AND 200);
Mark for Review
(1) Points
100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149 (*)
19
No rows will be returned
200, 201, 202, 203, 204, 205, 206
Correct Correct.
14. What clause must you place in a SQL statement to have your results sorted from highest to
lowest salary? Mark for Review
(1) Points
ORDER BY salary DESC (*)
ORDER salary BY DESC
None, the database always sorts from highest to lowest on the salary column.
ORDER BY salary ASC
Incorrect Incorrect! See Section 3 Lesson 2.
15. Which SELECT statement should you use to limit the display of product information to those
products with a price of less than 50? Mark for Review
(1) Points
SELECT product_id, product_name
FROM products
HAVING price < 50;
SELECT product_id, product_name
FROM products
WHERE price < 50;
(*)
SELECT product_id, product_name
FROM products
WHERE price <= 50;
SELECT product_id, product_name
FROM products
GROUP BY price < 50;
SELECT product_id, product_name
FROM products
WHERE price < 50.00
GROUP BY price;
Correct Correct.
Section 4 Quiz
(Answer all questions in this section)
1. You issue this SQL statement:
SELECT TRUNC(751.367,-1) FROM dual;
Which value does this statement display?
Mark for Review
(1) Points
750 (*)
700
751.3
751
Correct Correct
2. ROUND and TRUNC functions can be used with which of the following Datatypes? Mark for Review
(1) Points
Dates and numbers (*)
Dates and characters
Section 5 Quiz
(Answer all questions in this section)
1. Which best describes the TO_CHAR function? Mark for Review
(1) Points
The TO_CHAR function can be used to display dates and numbers according to formatting
conventions that are supported by Oracle. (*)
The TO_CHAR function can be used to remove text from column data that will be returned by the
database.
The TO_CHAR function can only be used on Date columns.
The TO_CHAR function can be used to specify meaningful column names in an SQL statement’s result
set.
Correct Correct
2. A table has the following definition: EMPLOYEES(
EMPLOYEE_ID NUMBER(6) NOT NULL,
NAME VARCHAR2(20) NOT NULL,
MANAGER_ID VARCHAR2(6))
and contains the following rows:
(1001, ‘Bob Bevan’, ‘200’)
(200, ‘Natacha Hansen’, null)
Will the folloiwng query work?
SELECT *
FROM employees
WHERE employee_id = manager_id; Mark for Review
(1) Points
Yes, Oracle will perform implicit datatype conversion, but the WHERE clause will not find any
matching data. (*)
No.? You will have to re-wirte the statement and perform explicit datatype conversion.
No, because the datatypes of EMPLOYEE_ID and MANAGER_ID are different.
Yes, Oracle will perform implicit dataype conversion, and the query will return one row of data.
Incorrect Incorrect. Refer to Section 5 Lesson 1.
3. If you use the RR format when writing a query using the date 27-Oct-17 and the year is 2001, what
year would be the result? Mark for Review
(1) Points
1901
2017 (*)
2001
1917
Correct Correct
4. Which statement concerning single row functions is true? Mark for Review
(1) Points
Single row functions can be nested. (*)
Single row functions return one or more results per row.
Single row functions cannot modify a data type.
Single row functions can accept only one argument, but can return multiple values.
Correct Correct
5. Which statement is true about SQL functions? Mark for Review
(1) Points
Functions can convert values or text to another data type.
Functions can round a number to a specified decimal place.
Functions can convert upper case characters to lower case characters.
a, b and c are true. (*)
None of the above statements are true.
Correct Correct
======================
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 5 Quiz
(Answer all questions in this section)
6. Which three statements concerning explicit data type conversions are true? (Choose three.) Mark
for Review
(1) Points
(Choose all correct answers)
Use the TO_DATE function to convert a character string to a date value. (*)
Use the TO_CHAR function to convert a number or date value to a character string. (*)
Use the TO_NUMBER function to convert a character string of digits to a number. (*)
Use the TO_NUMBER function to convert a number to a character string.
Use the TO_DATE function to convert a date value to a character string or number.
Correct Correct
7. Which function compares two expressions? Mark for Review
(1) Points
NVL2
NULL
NVL
NULLIF (*)
Correct Correct
8. When executed, which statement displays a zero if the TUITION_BALANCE value is zero and the
HOUSING_BALANCE value is null? Mark for Review
(1) Points
SELECT TO_NUMBER(tuition_balance, 0), TO_NUMBER (housing_balance, 0), tutition_balance +
housing_balance “Balance Due”
FROM student_accounts;
SELECT NVL(tuition_balance, 0), NVL (housing_balance), tuition_balance + housing_balance “Balance
Due”
FROM student_accounts;
SELECT NVL (tuition_balance + housing_balance, 0) “Balance Due”
FROM student_accounts;
(*)
SELECT tuition_balance + housing_balance
FROM student_accounts;
Correct Correct
9. You need to replace null values in the DEPT_ID column with the text N/A. Which functions should
you use? Mark for Review
(1) Points
TO_NUMBER and NULLIF
TO_CHAR and NULLIF
TO_CHAR and NULL
TO_CHAR and NVL (*)
Incorrect Incorrect. Refer to Section 5 Lesson 2.
10. The STYLES table contains this data:
STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85940 12.00
968950 SANDAL 85909 10.00
869506 SANDAL 89690 15.00
809090 LOAFER 89098 10.00
890890 LOAFER 89789 14.00
857689 HEEL 85940 11.00
758960 SANDAL 86979
Evaluate this SELECT statement:
SELECT style_id, style_name, category, cost
FROM styles
WHERE style_name LIKE ‘SANDAL’ AND NVL(cost, 0) < 15.00
ORDER BY category, cost;
Which result will the query provide?
Mark for Review
(1) Points
STYLE_ID STYLE_NAME CATEGORY COST
968950 SANDAL 85909 10.00
895840 SANDAL 85940 12.00
758960 SANDAL 86979
(*)
STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85909 12.00
968950 SANDAL 85909 10.00
869506 SANDAL 89690 15.00
758960 SANDAL 86979
STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85909 12.00
968950 SANDAL 85909 10.00
758960 SANDAL 86979
869506 SANDAL 89690 15.00
STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85940 12.00
968950 SANDAL 85909 10.00
758960 SANDAL 86979
Correct Correct
====================
Section 5 Quiz
(Answer all questions in this section)
11. With the following data in Employees (last_name, commission_pct, manager_id) what is the
result of the following statement?
DATA:
King, null, null
Kochhar, null, 100
Vargas, null, 124
Zlotkey, .2, 100
SELECT last_name, NVL2(commission_pct, manager_id, -1) comm
FROM employees ;
Mark for Review
(1) Points
King, -1
Kochhar, -1
Vargas, -1
Zlotkey, .2
Statement will fail.
King, -1
Kochhar, 100
Vargas, 124
Zlotkey, .2
King, -1
Kochhar, -1
Vargas, -1
Zlotkey, 100
(*)
Correct Correct
12. Which statement about group functions is true? Mark for Review
(1) Points
NVL, NVL2, and COALESCE can be used with group functions to replace null values. (*)
NVL and COALESCE, but not NVL2, can be used with group functions to replace null values.
COALESCE, but not NVL and NVL2, can be used with group functions to replace null values.
NVL and NVL2, but not COALESCE, can be used with group functions to replace null values.
Correct Correct
13. Which of the following is a conditional expression used in SQL? Mark for Review
(1) Points
CASE (*)
NULLIF
WHERE
DESCRIBE
Correct Correct
14. Which statement will return a listing of last names, salaries, and a rating of ‘Low’, ‘Medium’,
‘Good’ or ‘Excellent’ depending on the salary value? Mark for Review
(1) Points
SELECT last_name,salary,
(RATING WHEN salary<5000 THEN ‘Low’
WHEN salary<10000 THEN ‘Medium’
WHEN salary<20000 THEN ‘Good’
ELSE ‘Excellent’
END) qualified_salary
FROM employees;
SELECT last_name,salary,
(CASE WHEN salary<5000 THEN ‘Low’
WHEN sal <10000 THEN ‘Medium’
WHEN sal <20000 THEN ‘Good’
ELSE ‘Excellent’
END) qualified_salary
FROM employees;
SELECT last_name,sal,
(CASE WHEN sal<5000 THEN ‘Low’
WHEN sal<10000 THEN ‘Medium’
WHEN sal<20000 THEN ‘Good’
ELSE ‘Excellent’
END) qualified_salary
FROM employees;
SELECT last_name,salary,
(CASE WHEN salary<5000 THEN ‘Low’
WHEN salary<10000 THEN ‘Medium’
WHEN salary<20000 THEN ‘Good’
ELSE ‘Excellent’
END) qualified_salary
FROM employees;
(*)
Correct Correct
15. For the given data from Employees (last_name, manager_id) what is the result of the following
statement:
DATA:( King, null
Kochhar, 100
De Haan, 100
Hunold, 102
Ernst, 103)
SELECT last_name,
DECODE(manager_id, 100, ‘King’, ‘A N Other’) “Works For?”
FROM employees
Mark for Review
(1) Points
King, A N Other
Kochhar, King
De Haan, King
Hunold, A N Other
Ernst, A N Other
(*)
Invalid statement.
King, Null
Kochhar, King
De Haan, King
Hunold, A N Other
Ernst, A N Other
King, A N Other
Kochhar, King
De Haan, King
Hunold, Kochhar
Ernst, De Haan
Section 6 Quiz
(Answer all questions in this section)
1. When is an entity in 2nd Normal Form? Mark for Review
(1) Points
When all non-UID attributes are dependent upon the entire UID. (*)
When attributes with repeating or multi-values are present.
When no attritibutes are mutually independent and all are fully dependent on the primary key.
None of the Above.
Correct Correct
2. To resolve a 2nd Normal Form violation, we: Mark for Review
(1) Points
Move the attribute that violates 2nd Normal Form to a new ERD.
Move the attribute that violates 2nd Normal Form to a new entity with a relationship to the original
entity. (*)
Do nothing, an entity does not need to be in 2nd Normal Form.
Delete the attribute that was causing the violation.
Correct Correct
3. Examine the following entity and decide which attribute breaks the 2nd Normal Form rule:
ENTITY: RECEIPT
ATTRIBUTES:
#CUSTOMER ID
#STORE ID
STORE LOCATION
DATE
Mark for Review
(1) Points
STORE LOCATION (*)
CUSTOMER ID
DATE
STORE ID
Correct Correct
4. Examine the following Entity and decide which rule of Normal Form is being violated:
ENTITY: CLIENT ORDER
ATTRIBUTES:
# CLIENT ID
# ORDER ID
FIRST NAME
LAST NAME
ORDER DATE
CITY
ZIP CODE
Mark for Review
(1) Points
1st Normal Form.
2nd Normal Form. (*)
3rd Normal Form.
None of the above, the entity is fully normalised.
Incorrect Incorrect. Refer to Section 6 Lesson 4.
5. When any attribute in an entity is dependent on any other non-UID attribute in that entity, this is
known as: Mark for Review
(1) Points
Transitive dependency (*)
Functional dependency
Non-dependency
Dependency
Correct Correct
================
Section 6 Quiz
(Answer all questions in this section)
6. The Rule of 3rd Normal Form states that No Non-UID attribute can be dependent on another non-
UID attribute. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
7. A transitive dependency exists when any attribute in an entity is dependent on any other non-UID
attribute in that entity. Mark for Review
(1) Points
True (*)
False
Correct Correct
8. Where an entity has more than one attribute suitable to be the Primary UID, these are known as
_____________ UIDs. Mark for Review
(1) Points
Candidate (*)
Composite
Simple
Secondary
Correct Correct
9. An entity can only have one Primary UID. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
10. People are not born with ‘numbers’, but a lot of systems assign student numbers, customer IDs,
etc. ?These are known as a/an ______________ UID. Mark for Review
(1) Points
Identification
Unrealistic
Structured
Artificial (*)
Correct Correct
========
Section 6 Quiz
(Answer all questions in this section)
11. The candidate UID that is chosen to identify an entity is called the Primary UID; other candidate
UIDs are called Secondary UIDs. Mark for Review
(1) Points
Yes, this is the way UID’s are named. (*)
No, each Entity can only have one UID, the secondary one.
No, after UIDs are first sorted, the first one is called the Primary UID, the second is the Secondary
UID, etc.
No, it is not possible to have more than one UID for an Entity.
Correct Correct
12. When data is only stored in one place in a database, the database conforms to the rules of
___________. Mark for Review
(1) Points
Normalization (*)
Normality
Multiplication
Reduction
Correct Correct
13. When data is stored in more than one place in a database, the database violates the rules of
___________. Mark for Review
(1) Points
Normalization (*)
Decency
Replication
Normalcy
Correct Correct
14. An entity ORDER has the attributes Order ID, Order Date, Product id, Customer ID. This entity is in
1st Normal Form. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
15. Normalizing an Entity to 1st Normal Form is done by removing any attributes that contain muliple
values. True or False? Mark for Review
(1) Points
True (*)
False
Section 7 Quiz
(Answer all questions in this section)
1. Which of the following can be added to a relationship? Mark for Review
(1) Points
A composite attribute
An arc can be assigned (*)
An attribute
An optional attribute can be created
Correct Correct
2. All relationships participating in an arc must be mandatory. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 7 Lesson 1.
3. Which of the following would best be represented by an arc? Mark for Review
(1) Points
STUDENT (Grade A student, Average Student)
STUDENT (senior, male)
STUDENT (graduating, female)
STUDENT ( University, Technical College) (*)
Correct Correct
4. Every business has restrictions on which attribute values and which relationships are allowed.
These are known as: Mark for Review
(1) Points
Attributes
Constraints. (*)
Entities.
Relationships
Correct Correct
5. Arcs model an Exclusive OR constraint. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
============
er all questions in this section)
6. Which of the following would best be represented by an arc? Mark for Review
(1) Points
TEACHER (Female, Bob)
DELIVERY ADDRESS (Home, Office) (*)
STUDENT (Grade A student, Average Student)
PARENT (Girl, Bob)
Correct Correct
7. Arcs are used to visually represent _________ between two or more relationships in an ERD. Mark
for Review
(1) Points
Differences
Inheritance
Sameness
Exclusivity (*)
Correct Correct
8. An arc can often be modeled as Supertype and Subtypes. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
9. A relationship between an entity and itself is called a/an: Mark for Review
(1) Points
General Relationship
Invalid Relationship
Recursive Relationship (*)
Heirarchical Relationship
Correct Correct
10. Cascading UIDs are a feature often found in what type of Relationship? Mark for Review
(1) Points
Invalid Relationship
Heirarchical Relationship (*)
Recursive Relationship
General Relationship
Correct Correct
======
11. A particular problem may be solved using either a Recursive Relationship or a Hierarchical
Relationship, though not at the same time. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
12. Business organizational charts are often modeled as a Hierarchical relationship. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
13. A Recursive Relationship is represented on an ERD by a/an: Mark for Review
(1) Points
Single Toe
Dog’s Tail
Crow’s Foot
Pig’s Ear (*)
Correct Correct
14. A Hierarchical relationship is a series of relationships that reflect entities organized into
successive levels. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
15. A single relationship can be both Recursive and Hierarchical at the same time. True or False?
Mark for Review
(1) Points
True
False (*)
Section 7 Quiz
(Answer all questions in this section)
1. You need to provide a list of the first and last names of all employees who work in the Sales
department who earned a bonus and had sales over $50,000. The company president would like the
sales listed starting with the highest amount first. The EMPLOYEES table and the SALES_DEPT table
contain the following columns:
EMPLOYEES
EMP_ID NUMBER(10) PRIMARY KEY
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2(20)
DEPTARTMENT_ID VARCHAR2(20)
HIRE_DATE DATE
SALARY NUMBER(10)
SALES_DEPT
SALES_ID NUMBER(10) PRIMARY KEY
SALES NUMBER(20)
QUOTA NUMBER(20)
MANAGER VARCHAR2(30)
BONUS NUMBER(10)
EMPLOYEE_ID NUMBER(10) FOREIGN KEY
Which SELECT statement will accomplish this task?
Mark for Review
(1) Points
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
FROM employees e, sales_dept s
WHERE e.employee_id = s.employee_id AND s.bonus IS NOT NULL AND sales > 50000
ORDER BY sales DESC;
(*)
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s.sales
FROM employees e, sales_dept s
ORDER BY sales DESC
WHERE e.employee_id = s.employee_id AND sales > 50000 AND s.bonus IS NOT NULL;
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
ORDER BY sales DESC
FROM employees e, sales_dept s
WHERE e.employee_id = s.employee_id AND s.bonus IS NOT NULL AND sales > 50000;
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
WHERE e.employee_id = s.employee_id
FROM employees e, sales_dept s AND s.bonus IS NOT NULL AND sales > 50000
ORDER BY sales DESC;
Correct Correct
2. The PATIENTS and DOCTORS tables contain these columns:
PATIENTS
PATIENT_ID NUMBER(9)
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
DOCTORS
DOCTOR_ID NUMBER(9)
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
You issue this statement:
SELECT patient_id, doctor_id
FROM patients, doctors;
Which result will this statement provide?
Mark for Review
(1) Points
A report containing all possible combinations of the PATIENT_ID and DOCTOR_ID values (*)
A report with NO duplicate PATIENT_ID or DOCTOR_ID values
A syntax error
A report containing each patient’s id value and his doctor’s id value
Correct Correct
3. Will the following statement work?
SELECT department_name, last_name
FROM employees, departments
WHERE department_id = department_id;
Mark for Review
(1) Points
Yes, Oracle will resolve which department_id colum comes from which table.
No, Oracle will not allow joins in the WHERE clause
No, Oracle will return a Column Ambiguously Defined error. (*)
Yes, there are no syntax errors in that statement
Incorrect Incorrect. Refer to Section 7 Lesson 1.
4. When must column names be prefixed by table names in join syntax? Mark for Review
(1) Points
When the same column name appears in more than one table of the query (*)
When the more than two tables participate in the join
Only when query speed and database performance is a concern
Never
Correct Correct
5. You need to create a report that lists all employees in department 10 (Sales) whose salary is not
equal to $25,000 per year. Which query should you issue to accomplish this task? Mark for Review
(1) Points
SELECT last_name, first_name, salary
FROM employees
WHERE salary != 25000 AND dept_id = 10;
(*)
SELECT last_name, first_name, salary
FROM employees
WHERE salary > 25000 AND dept_id = 10;
SELECT last_name, first_name, salary
FROM employees
WHERE salary = 25000 AND dept_id = 10;
SELECT last_name, first_name, salary
FROM employees
WHERE salary <= 25000 AND dept_id = 10;
============
Section 7 Quiz
(Answer all questions in this section)
6. Oracle proprietary JOINS can use the WHERE clause for conditions other than the join-condition.
True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
7. You have two tables named EMPLOYEES and SALES. You want to identify the sales representatives
who have generated at least $100,000 in revenue.
Which query should you issue? Mark for Review
(1) Points
SELECT first_name, last_name, sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue > 100000;
SELECT e.first_name, e.last_name, s.sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue > 100000;
SELECT e.first_name, e.last_name, s.sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue >= 100000;
(*)
SELECT e.first_name, e.last_name, s.sales
FROM employees, sales
WHERE e.employee_id = s.employee_id AND revenue >= 100000;
Correct Correct
8. What is produced when a join condition is not specified in a multiple-table query using Oracle
proprietary Join syntax? Mark for Review
(1) Points
A self-join
An outer join
An equijoin
A Cartesian product (*)
Correct Correct
9. The following statement is an example of a nonequi-join?
SELECT e.last_name, e.salary, j.grade_level
FROM employees e, job_grades j
WHERE e.salary
BETWEEN j.lowest_sal AND j.highest_sal;
True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
10. Which operator is typically used in a nonequijoin? Mark for Review
(1) Points
OR
>=, <=, or BETWEEN …AND (*)
IN
*
NOT
Correct Correct
==============
11. The ID column in the CLIENT table that corresponds to the CLIENT_ID column of the ORDER table
contains null values for rows that need to be displayed. Which type of join should you use to display
the data? Mark for Review
(1) Points
Self join
Equijoin
Nonequi-Join
Outer join (*)
Correct Correct
12. Which symbol is used to perform an outer join? Mark for Review
(1) Points
#
*
(+) (*)
||
Correct Correct
13. The EMPLOYEE_ID column in the EMPLOYEES table corresponds to the EMPLOYEE_ID column of
the ORDERS table.
The EMPLOYEE_ID column in the ORDERS table contains null values for rows that you need to
display.
Which type of join should you use to display the data? Mark for Review
(1) Points
Self-join
Natural join
Outer join (*)
Equijoin
Incorrect Incorrect. Refer to Section 7 Lesson 2.
14. Which of the following best describes the function of an outer join? Mark for Review
(1) Points
An outer join will return only data from the far left column in one table and the far right column in
the other table.
An outer join will return only those rows that do not meet the join criteria.
An outer join will return data only if both tables contain an identical pair of columns.
An outer join will return all rows that meet the join criteria and will return NULL values from one
table if no rows from the other table satisfy the join criteria. (*)
Incorrect Incorrect. Refer to Section 7 Lesson 2.
15. You need to join the EMPLOYEES table and the SCHEDULES table, but the two tables do not have
any corresponding columns. Which type of join will you create? Mark for Review
(1) Points
A non-equijoin (*)
An equijoin
It is not possible to join these two tables.
A full outer join
Section 7 Quiz
(Answer all questions in this section)
1. You need to provide a list of the first and last names of all employees who work in the Sales
department who earned a bonus and had sales over $50,000. The company president would like the
sales listed starting with the highest amount first. The EMPLOYEES table and the SALES_DEPT table
contain the following columns:
EMPLOYEES
EMP_ID NUMBER(10) PRIMARY KEY
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2(20)
DEPTARTMENT_ID VARCHAR2(20)
HIRE_DATE DATE
SALARY NUMBER(10)
SALES_DEPT
SALES_ID NUMBER(10) PRIMARY KEY
SALES NUMBER(20)
QUOTA NUMBER(20)
MANAGER VARCHAR2(30)
BONUS NUMBER(10)
EMPLOYEE_ID NUMBER(10) FOREIGN KEY
Which SELECT statement will accomplish this task?
Mark for Review
(1) Points
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
FROM employees e, sales_dept s
WHERE e.employee_id = s.employee_id AND s.bonus IS NOT NULL AND sales > 50000
ORDER BY sales DESC;
(*)
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s.sales
FROM employees e, sales_dept s
ORDER BY sales DESC
WHERE e.employee_id = s.employee_id AND sales > 50000 AND s.bonus IS NOT NULL;
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
ORDER BY sales DESC
FROM employees e, sales_dept s
WHERE e.employee_id = s.employee_id AND s.bonus IS NOT NULL AND sales > 50000;
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
WHERE e.employee_id = s.employee_id
FROM employees e, sales_dept s AND s.bonus IS NOT NULL AND sales > 50000
ORDER BY sales DESC;
Correct Correct
2. The PATIENTS and DOCTORS tables contain these columns:
PATIENTS
PATIENT_ID NUMBER(9)
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
DOCTORS
DOCTOR_ID NUMBER(9)
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
You issue this statement:
SELECT patient_id, doctor_id
FROM patients, doctors;
Which result will this statement provide?
Mark for Review
(1) Points
A report containing all possible combinations of the PATIENT_ID and DOCTOR_ID values (*)
A report with NO duplicate PATIENT_ID or DOCTOR_ID values
A syntax error
A report containing each patient’s id value and his doctor’s id value
Correct Correct
3. Will the following statement work?
SELECT department_name, last_name
FROM employees, departments
WHERE department_id = department_id;
Mark for Review
(1) Points
Yes, Oracle will resolve which department_id colum comes from which table.
No, Oracle will not allow joins in the WHERE clause
No, Oracle will return a Column Ambiguously Defined error. (*)
Yes, there are no syntax errors in that statement
Incorrect Incorrect. Refer to Section 7 Lesson 1.
4. When must column names be prefixed by table names in join syntax? Mark for Review
(1) Points
When the same column name appears in more than one table of the query (*)
When the more than two tables participate in the join
Only when query speed and database performance is a concern
Never
Correct Correct
5. You need to create a report that lists all employees in department 10 (Sales) whose salary is not
equal to $25,000 per year. Which query should you issue to accomplish this task? Mark for Review
(1) Points
SELECT last_name, first_name, salary
FROM employees
WHERE salary != 25000 AND dept_id = 10;
(*)
SELECT last_name, first_name, salary
FROM employees
WHERE salary > 25000 AND dept_id = 10;
SELECT last_name, first_name, salary
FROM employees
WHERE salary = 25000 AND dept_id = 10;
SELECT last_name, first_name, salary
FROM employees
WHERE salary <= 25000 AND dept_id = 10;
============
Section 7 Quiz
(Answer all questions in this section)
6. Oracle proprietary JOINS can use the WHERE clause for conditions other than the join-condition.
True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
7. You have two tables named EMPLOYEES and SALES. You want to identify the sales representatives
who have generated at least $100,000 in revenue.
Which query should you issue? Mark for Review
(1) Points
SELECT first_name, last_name, sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue > 100000;
SELECT e.first_name, e.last_name, s.sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue > 100000;
SELECT e.first_name, e.last_name, s.sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue >= 100000;
(*)
SELECT e.first_name, e.last_name, s.sales
FROM employees, sales
WHERE e.employee_id = s.employee_id AND revenue >= 100000;
Correct Correct
8. What is produced when a join condition is not specified in a multiple-table query using Oracle
proprietary Join syntax? Mark for Review
(1) Points
A self-join
An outer join
An equijoin
A Cartesian product (*)
Correct Correct
9. The following statement is an example of a nonequi-join?
SELECT e.last_name, e.salary, j.grade_level
FROM employees e, job_grades j
WHERE e.salary
BETWEEN j.lowest_sal AND j.highest_sal;
True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
10. Which operator is typically used in a nonequijoin? Mark for Review
(1) Points
OR
>=, <=, or BETWEEN …AND (*)
IN
*
NOT
Correct Correct
==============
11. The ID column in the CLIENT table that corresponds to the CLIENT_ID column of the ORDER table
contains null values for rows that need to be displayed. Which type of join should you use to display
the data? Mark for Review
(1) Points
Self join
Equijoin
Nonequi-Join
Outer join (*)
Correct Correct
12. Which symbol is used to perform an outer join? Mark for Review
(1) Points
#
*
(+) (*)
||
Correct Correct
13. The EMPLOYEE_ID column in the EMPLOYEES table corresponds to the EMPLOYEE_ID column of
the ORDERS table.
The EMPLOYEE_ID column in the ORDERS table contains null values for rows that you need to
display.
Which type of join should you use to display the data? Mark for Review
(1) Points
Self-join
Natural join
Outer join (*)
Equijoin
Incorrect Incorrect. Refer to Section 7 Lesson 2.
14. Which of the following best describes the function of an outer join? Mark for Review
(1) Points
An outer join will return only data from the far left column in one table and the far right column in
the other table.
An outer join will return only those rows that do not meet the join criteria.
An outer join will return data only if both tables contain an identical pair of columns.
An outer join will return all rows that meet the join criteria and will return NULL values from one
table if no rows from the other table satisfy the join criteria. (*)
Incorrect Incorrect. Refer to Section 7 Lesson 2.
15. You need to join the EMPLOYEES table and the SCHEDULES table, but the two tables do not have
any corresponding columns. Which type of join will you create? Mark for Review
(1) Points
A non-equijoin (*)
An equijoin
It is not possible to join these two tables.
A full outer join
Section 8 Quiz
(Answer all questions in this section)
1. Which of the following would be a logical constraint when modeling time for a country entity?
Mark for Review
(1) Points
Daily traffic patterns must be monitored to determine which countries are overcrowded.
If you are doing a system for France or Germany, you would need security clearance.
People have births and deaths in their countries that must be tracked by the system.
Countries may change their names and/or borders over a period of time. (*)
Correct Correct
2. In a payroll system, it is desirable to have an entity called DAY with a holiday attribute when you
want to track special holiday dates. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
3. If you have an entity that a DATE attribute, and other attributes that track characteristics of the
date, you should create a DAY entity. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
4. How do you know when to use the different types of time in your design? Mark for Review
(1) Points
The rules are fixed and should be followed.
You would first determine the existence of the concept of time and map it against the Greenwich
Mean Time.
Always model time; you can take it out later if it is not needed.
It depends on the functional needs of the system . (*)
Correct Correct
5. Which of the following would be a logical constraint when modeling time for a City entity? Mark
for Review
(1) Points
People are born in the city and people die in the city.
Cites may change their names and/or country association if the borders of a country change. (*)
Daily traffic patterns must be monitored to determine how many law enforcement officers are
needed.
If you are doing a system for any French City, you would need security clearance.
Correct Correct
=========
(Answer all questions in this section)
6. There is no point in trying to group your entities together on your diagram according to volume,
and making a diagram look nice is a waste of time. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
7. In an ERD, High Volume Entities usually have very few relationships to other entities. True or
False? Mark for Review
(1) Points
True
False (*)
Correct Correct
8. Formal rules exist for drawing ERD’s. You must always follow them, even if it results in an ERD that
is difficult to read. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
9. No formal rules exist for drawing ERD’s. The most important thing is to make sure that all entities,
attributes, and relationships are documented on the diagram, and the diagram is clear and readable.
True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
10. You are doing a data model for a computer sales company where the price fluctuates on a regular
basis. If you want to allow the company to modify the price and keep track of the changes, what is
the best way to model this? Mark for Review
(1) Points
A. Create a product entity and a related price entity with start and end dates, and then let the users
enter the new price whenever required.
B. Create a new item and a new price every day.
C. Use a price entity with a start and end date
D. Allow them to delete the item and enter a new one.
E. Both A and C (*)
Incorrect Incorrect. Refer to Section 8 Lesson 3.
=====
Section 8 Quiz
(Answer all questions in this section)
11. What is the function of logging or journaling in conceptual data models? Mark for Review
(1) Points
Represents entities as time in the data model.
Creates a fixed time for all events in a data model.
Gives a timestamp to all entities.
Allows you to track the history of attribute values, relationships, and/or entire entities (*)
Correct Correct
12. When a system requires that old values for attributes are kept on record, this is know as
Journaling or Logging. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
13. Which of the following scenarios should be modeled so that historical data is kept? (Choose two)
Mark for Review
(1) Points
(Choose all correct answers)
STUDENT and GRADE (*)
LIBRARY and BOOK (*)
LIBRARY and NUMBER OF BOOKS
STUDENT and AGE
Correct Correct
14. Which of the following scenarios should be modeled so that historical data is kept? (Choose two)
Mark for Review
(1) Points
(Choose all correct answers)
TEACHER and AGE
CUSTOMER and ORDERS (*)
BABY and AGE
CUSTOMER and PAYMENTS (*)
Incorrect Incorrect. Refer to Section 8 Lesson 1.
15. Historical data must never be kept. True or False? Mark for Review
(1) Points
True
False (*)
Section 8 Quiz
(Answer all questions in this section)
1. Evaluate this SELECT statement:
SELECT COUNT(*)
FROM employees
WHERE salary > 30000;
Which result will the query display?
Mark for Review
(1) Points
The total of the SALARY column for all employees that have a salary greater than 30000
The number of rows in the EMPLOYEES table that have a salary greater than 30000 (*)
The number of employees that have a salary less than 30000
The query generates an error and returns no results.
Incorrect Incorrect. Refer to Section 8 Lesson 2.
2. What would the following SQL statement return?
SELECT COUNT(DISTINCT salary)
FROM employees;
Mark for Review
(1) Points
Section 7 Quiz
(Answer all questions in this section)
1. The EMPLOYEE_ID column in the EMPLOYEES table corresponds to the EMPLOYEE_ID column of
the ORDERS table.
The EMPLOYEE_ID column in the ORDERS table contains null values for rows that you need to
display.
Which type of join should you use to display the data? Mark for Review
(1) Points
Self-join
Equijoin
Outer join (*)
Natural join
Correct Correct
2. You need to join the EMPLOYEES table and the SCHEDULES table, but the two tables do not have
any corresponding columns. Which type of join will you create? Mark for Review
(1) Points
It is not possible to join these two tables.
A non-equijoin (*)
A full outer join
An equijoin
Correct Correct
3. Evaluate this SELECT statement:
SELECT p.player_id, m.last_name, m.first_name, t.team_name
FROM player p
LEFT OUTER JOIN player m ON (p.manager_id = m.player_id)
LEFT OUTER JOIN team t ON (p.team_id = t.team_id);
Which join is evaluated first?
Mark for Review
(1) Points
The join between the player table and the team table on TEAM_ID
The join between the player table and the team table on MANAGER_ID
The join between the player table and the team table on PLAYER_ID
The self-join of the player table (*)
Correct Correct
4. Which of the following best describes the function of an outer join? Mark for Review
(1) Points
An outer join will return data only if both tables contain an identical pair of columns.
An outer join will return only data from the far left column in one table and the far right column in
the other table.
An outer join will return only those rows that do not meet the join criteria.
An outer join will return all rows that meet the join criteria and will return NULL values from one
table if no rows from the other table satisfy the join criteria. (*)
Incorrect Incorrect. Refer to Section 7 Lesson 2.
5. Using Oracle Proprietary join syntax, which operator would you use after one of the column names
in the WHERE clause when creating an outer join? Mark for Review
(1) Points
+
(+) (*)
=
*
Incorrect Incorrect. Refer to Section 7 Lesson 2.
=========
Section 7 Quiz
(Answer all questions in this section)
6. The following is a valid outer join statement:
SELECT c.country_name, d.department_name
FROM countries c, departments d
WHERE c.country_id (+) = d.country_id (+)
True or False?
Mark for Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 7 Lesson 2.
7. Which operator is typically used in a nonequijoin? Mark for Review
(1) Points
IN
NOT
*
>=, <=, or BETWEEN …AND (*)
OR
Correct Correct
8. When must column names be prefixed by table names in join syntax? Mark for Review
(1) Points
When the same column name appears in more than one table of the query (*)
When the more than two tables participate in the join
Never
Only when query speed and database performance is a concern
Correct Correct
9. You need to provide a list of the first and last names of all employees who work in the Sales
department who earned a bonus and had sales over $50,000. The company president would like the
sales listed starting with the highest amount first. The EMPLOYEES table and the SALES_DEPT table
contain the following columns:
EMPLOYEES
EMP_ID NUMBER(10) PRIMARY KEY
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2(20)
DEPTARTMENT_ID VARCHAR2(20)
HIRE_DATE DATE
SALARY NUMBER(10)
SALES_DEPT
SALES_ID NUMBER(10) PRIMARY KEY
SALES NUMBER(20)
QUOTA NUMBER(20)
MANAGER VARCHAR2(30)
BONUS NUMBER(10)
EMPLOYEE_ID NUMBER(10) FOREIGN KEY
Which SELECT statement will accomplish this task?
Mark for Review
(1) Points
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
WHERE e.employee_id = s.employee_id
FROM employees e, sales_dept s AND s.bonus IS NOT NULL AND sales > 50000
ORDER BY sales DESC;
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
FROM employees e, sales_dept s
WHERE e.employee_id = s.employee_id AND s.bonus IS NOT NULL AND sales > 50000
ORDER BY sales DESC;
(*)
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s.sales
FROM employees e, sales_dept s
ORDER BY sales DESC
WHERE e.employee_id = s.employee_id AND sales > 50000 AND s.bonus IS NOT NULL;
SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
ORDER BY sales DESC
FROM employees e, sales_dept s
WHERE e.employee_id = s.employee_id AND s.bonus IS NOT NULL AND sales > 50000;
Correct Correct
10. Will the following statement work?
SELECT department_name, last_name
FROM employees, departments
WHERE department_id = department_id;
Mark for Review
(1) Points
No, Oracle will return a Column Ambiguously Defined error. (*)
Yes, there are no syntax errors in that statement
Yes, Oracle will resolve which department_id colum comes from which table.
No, Oracle will not allow joins in the WHERE clause
Correct Correct
===========
Section 7 Quiz
(Answer all questions in this section)
11. What happens when you create a Cartesian product? Mark for Review
(1) Points
All rows that do not match in the WHERE clause are displayed
The table is joined to itself, one column to the next column, exhausting all possibilities
All rows from one table are joined to all rows of another table (*)
The table is joined to another equal table
Correct Correct
12. You have the following EMPLOYEES table:
EMPLOYEE_ID NUMBER(5) NOT NULL PRIMARY KEY
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
ADDRESS VARCHAR2(35)
CITY VARCHAR2(25)
STATE VARCHAR2(2)
ZIP NUMBER(9)
TELEPHONE NUMBER(10)
DEPARTMENT_ID NUMBER(5) NOT NULL FOREIGN KEY
The BONUS table includes the following columns:
BONUS_ID NUMBER(5) NOT NULL PRIMARY KEY
ANNUAL_SALARY NUMBER(10)
BONUS_PCT NUMBER(3, 2)
EMPLOYEE_ID VARCHAR2(5) NOT NULL FOREIGN KEY
You want to determine the amount of each employee’s bonus as a calculation of salary times bonus.
Which of the following queries should you issue?
Mark for Review
(1) Points
SELECT e.first_name, e.last_name, b.annual_salary, b. bonus_pct
FROM employees, bonus
WHERE e.employee_id = b.employee_id;
SELECT e.first_name, e.last_name, b.annual_salary * b. bonus_pct
FROM employees e, bonus b
WHERE e.employee_id = b.employee_id;
(*)
SELECT first_name, last_name, annual_salary * bonus_pct
FROM employees, bonus NATURAL JOIN;
SELECT e.first_name, e.last_name, b.annual_salary, b. bonus_pct
FROM employees e, bonus b
WHERE e.employee_id = b.employee_id;
Correct Correct
13. You have been asked to create a report that lists all corporate customers and all orders that they
have placed. The customers should be listed alphabetically beginning with the letter ‘A’, and their
corresponding order totals should be sorted from the highest amount to the lowest amount.
Which of the following statements should you issue? Mark for Review
(1) Points
SELECT c.custid, c.companyname, o.orderdate, o. custid, o.amount
FROM customers c, orders o
WHERE c.custid = o.custid
ORDER BY companyname ASC, amount ASC;
SELECT c.custid, c.companyname, o.orderdate, o. custid, o.amount
FROM customers c, orders o
WHERE c.custid = o.custid
ORDER BY amount DESC, companyname;
SELECT c.custid, c.companyname, o.orderdate, o. custid, o.amount
FROM customers c, orders o
WHERE c.custid = o.custid
ORDER BY companyname, amount;
SELECT c.custid, c.companyname, o.orderdate, o. custid, o.amount
FROM customers c, orders o
WHERE c.custid = o.custid
ORDER BY companyname, amount DESC;
(*)
Correct Correct
14. You need to create a report that lists all employees in department 10 (Sales) whose salary is not
equal to $25,000 per year. Which query should you issue to accomplish this task? Mark for Review
(1) Points
SELECT last_name, first_name, salary
FROM employees
WHERE salary != 25000 AND dept_id = 10;
(*)
SELECT last_name, first_name, salary
FROM employees
WHERE salary = 25000 AND dept_id = 10;
SELECT last_name, first_name, salary
FROM employees
WHERE salary > 25000 AND dept_id = 10;
SELECT last_name, first_name, salary
FROM employees
WHERE salary <= 25000 AND dept_id = 10;
Correct Correct
15. When joining 3 tables in a SELECT statement, how many join conditions are needed in the WHERE
clause? Mark for Review
(1) Points
3
2 (*)
1
0
Section 10 Quiz
(Answer all questions in this section)
1. Which answer is INCORRECT? The parent statement of a correlated subquery can be: Mark for
Review
(1) Points
An INSERT statement (*)
A SELECT statement
A DELETE statement
An UPDATE statement
Correct Correct
2. Table aliases must be used when you are writing correlated subqueries. (True or false?) Mark for
Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 10 Lesson 4.
3. Oracle allows you to write named subqueries in one single statement, as long as you start your
statement with the keyword WITH. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
4. Which statement about subqueries is true? Mark for Review
(1) Points
Subqueries generally execute last, after the main or outer query executes.
Subqueries cannot contain group functions.
Subqueries are often used in a WHERE clause to return values for an unknown conditional value. (*)
Subqueries should be enclosed in double quotation marks.
Correct Correct
5. Subqueries can only be placed in the WHERE clause. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
========================
6. The TEACHERS and CLASS_ASSIGNMENTS tables contain these columns:
TEACHERS
TEACHER_ID NUMBER(5) Primary Key
NAME VARCHAR2 (25)
SUBJECT_ID NUMBER(5)
CLASS_ID NUMBER(5)
CLASS_ASSIGNMENTS
CLASS_ID NUMBER (5) Primary Key
TEACHER_ID NUMBER (5)
DATE
MAX_CAPACITY NUMBER (3)
All MAX_CAPACITY values are greater than 10. Which two SQL statements correctly use subqueries?
(Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
SELECT *
FROM teachers
WHERE teacher_id = (SELECT teacher_id FROM class_assignments WHERE class_id = 45963);
(*)
SELECT *
FROM class_assignments
max_capacity = (SELECT AVG(max_capacity) FROM class_assignments GROUP BY teacher_id);
SELECT *
FROM class_assignments
WHERE max_capacity = (SELECT AVG(max_capacity) FROM class_assignments);
(*)
SELECT *
FROM teachers
WHERE teacher_id LIKE (SELECT teacher_id FROM class_assignments WHERE max_capacity > 1000);
SELECT *
FROM teachers
WHERE teacher_id = (SELECT teacher_id, class_assignments WHERE max_capacity > 0);
Incorrect Incorrect. Refer to Section 10 Lesson 1.
7. The result of this statement will be:
SELECT last_name, job_id, salary, department_id
FROM employees
WHERE job_id =
(SELECT job_id
FROM employees
WHERE employee_id = 141) AND
department_id =
(SELECT department_id
FROM departments
WHERE location_id =1500);
Mark for Review
(1) Points
Only the employees whose job id matches employee 141 and who work in location 1500 (*)
An error since you can?t get data from two tables in the same subquery
All employees with the department id of 141
All employees from Location 1500 will be displayed
Correct Correct
8. Which best describes a single-row subquery? Mark for Review
(1) Points
A query that returns one or more rows from the inner SELECT statement
A query that returns only one row from the inner SELECT statement (*)
A query that returns only one column value from the inner SELECT statement
A query that returns one or more column values from the inner SELECT statement
Correct Correct
9. In a non-correlated subquery, the outer query always executes prior to the inner query’s
execution. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
10. Group functions can be used in multiple-row subqueries in the HAVING and GROUP BY clauses.
True or False? Mark for Review
(1) Points
True (*)
False
============
Section 10 Quiz
(Answer all questions in this section)
11. What is wrong with the following query?
SELECT employee_id, last_name
FROM employees
WHERE salary =
(SELECT MIN(salary) FROM employees GROUP BY department_id); Mark for Review
(1) Points
Single rows contain multiple values and a logical operator is used.
Subquery returns more than one row and single row comparison operator is used. (*)
Nothing, it will run without problems.
Subquery references the wrong table in the WHERE clause.
Correct Correct
12. The SQL multiple-row subquery extends the capability of the single-row syntax through the use of
which three comparison operators? Mark for Review
(1) Points
IN, ANY, and EVERY
IN, ANY, and EQUAL
IN, ALL, and EVERY
IN, ANY, and ALL (*)
Correct Correct
13. Evaluate this SELECT statement that includes a subquery:
SELECT last_name, first_name
FROM customer
WHERE area_code IN
(SELECT area_code
FROM sales
WHERE salesperson_id = 20);
Which statement is true about the given subquery?
Mark for Review
(1) Points
The results of the inner query are returned to the outer query. (*)
The outer query executes before the nested subquery.
An error occurs if either the inner or outer queries do not return a value.
Both the inner and outer queries must return a value, or an error occurs.
Correct Correct
14. Evaluate this SELECT statement:
SELECT player_id, name
FROM players
WHERE team_id IN
(SELECT team_id
FROM teams
WHERE team_id > 300 AND salary_cap > 400000);
What would happen if the inner query returned a NULL value?
Mark for Review
(1) Points
No rows would be returned by the outer query. (*)
A syntax error in the outer query would be returned.
A syntax error in the inner query would be returned.
All the rows in the PLAYER table would be returned by the outer query.
Correct Correct
15. When a multiple-row subquery uses the NOT IN operator (equivalent to <>ALL), if one of the
values returned by the inner query is a null value, the entire query returns: Mark for Review
(1) Points
A list of Nulls
No rows returned (*)
All rows that were selected by the inner query including the null values
All rows that were selected by the inner query minus the null values
Section 10 Quiz
(Answer all questions in this section)
1. Which answer is INCORRECT? The parent statement of a correlated subquery can be: Mark for
Review
(1) Points
An INSERT statement (*)
A SELECT statement
A DELETE statement
An UPDATE statement
Correct Correct
2. Table aliases must be used when you are writing correlated subqueries. (True or false?) Mark for
Review
(1) Points
True
False (*)
Incorrect Incorrect. Refer to Section 10 Lesson 4.
3. Oracle allows you to write named subqueries in one single statement, as long as you start your
statement with the keyword WITH. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
4. Which statement about subqueries is true? Mark for Review
(1) Points
Subqueries generally execute last, after the main or outer query executes.
Subqueries cannot contain group functions.
Subqueries are often used in a WHERE clause to return values for an unknown conditional value. (*)
Subqueries should be enclosed in double quotation marks.
Correct Correct
5. Subqueries can only be placed in the WHERE clause. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
========================
6. The TEACHERS and CLASS_ASSIGNMENTS tables contain these columns:
TEACHERS
TEACHER_ID NUMBER(5) Primary Key
NAME VARCHAR2 (25)
SUBJECT_ID NUMBER(5)
CLASS_ID NUMBER(5)
CLASS_ASSIGNMENTS
CLASS_ID NUMBER (5) Primary Key
TEACHER_ID NUMBER (5)
DATE
MAX_CAPACITY NUMBER (3)
All MAX_CAPACITY values are greater than 10. Which two SQL statements correctly use subqueries?
(Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
SELECT *
FROM teachers
WHERE teacher_id = (SELECT teacher_id FROM class_assignments WHERE class_id = 45963);
(*)
SELECT *
FROM class_assignments
max_capacity = (SELECT AVG(max_capacity) FROM class_assignments GROUP BY teacher_id);
SELECT *
FROM class_assignments
WHERE max_capacity = (SELECT AVG(max_capacity) FROM class_assignments);
(*)
SELECT *
FROM teachers
WHERE teacher_id LIKE (SELECT teacher_id FROM class_assignments WHERE max_capacity > 1000);
SELECT *
FROM teachers
WHERE teacher_id = (SELECT teacher_id, class_assignments WHERE max_capacity > 0);
Incorrect Incorrect. Refer to Section 10 Lesson 1.
7. The result of this statement will be:
SELECT last_name, job_id, salary, department_id
FROM employees
WHERE job_id =
(SELECT job_id
FROM employees
WHERE employee_id = 141) AND
department_id =
(SELECT department_id
FROM departments
WHERE location_id =1500);
Mark for Review
(1) Points
Only the employees whose job id matches employee 141 and who work in location 1500 (*)
An error since you can?t get data from two tables in the same subquery
All employees with the department id of 141
All employees from Location 1500 will be displayed
Correct Correct
8. Which best describes a single-row subquery? Mark for Review
(1) Points
A query that returns one or more rows from the inner SELECT statement
A query that returns only one row from the inner SELECT statement (*)
A query that returns only one column value from the inner SELECT statement
A query that returns one or more column values from the inner SELECT statement
Correct Correct
9. In a non-correlated subquery, the outer query always executes prior to the inner query’s
execution. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
10. Group functions can be used in multiple-row subqueries in the HAVING and GROUP BY clauses.
True or False? Mark for Review
(1) Points
True (*)
False
============
Section 10 Quiz
(Answer all questions in this section)
11. What is wrong with the following query?
SELECT employee_id, last_name
FROM employees
WHERE salary =
(SELECT MIN(salary) FROM employees GROUP BY department_id); Mark for Review
(1) Points
Single rows contain multiple values and a logical operator is used.
Subquery returns more than one row and single row comparison operator is used. (*)
Nothing, it will run without problems.
Subquery references the wrong table in the WHERE clause.
Correct Correct
12. The SQL multiple-row subquery extends the capability of the single-row syntax through the use of
which three comparison operators? Mark for Review
(1) Points
IN, ANY, and EVERY
IN, ANY, and EQUAL
IN, ALL, and EVERY
IN, ANY, and ALL (*)
Correct Correct
13. Evaluate this SELECT statement that includes a subquery:
SELECT last_name, first_name
FROM customer
WHERE area_code IN
(SELECT area_code
FROM sales
WHERE salesperson_id = 20);
Which statement is true about the given subquery?
Mark for Review
(1) Points
The results of the inner query are returned to the outer query. (*)
The outer query executes before the nested subquery.
An error occurs if either the inner or outer queries do not return a value.
Both the inner and outer queries must return a value, or an error occurs.
Correct Correct
14. Evaluate this SELECT statement:
SELECT player_id, name
FROM players
WHERE team_id IN
(SELECT team_id
FROM teams
WHERE team_id > 300 AND salary_cap > 400000);
What would happen if the inner query returned a NULL value?
Mark for Review
(1) Points
No rows would be returned by the outer query. (*)
A syntax error in the outer query would be returned.
A syntax error in the inner query would be returned.
All the rows in the PLAYER table would be returned by the outer query.
Correct Correct
15. When a multiple-row subquery uses the NOT IN operator (equivalent to <>ALL), if one of the
values returned by the inner query is a null value, the entire query returns: Mark for Review
(1) Points
A list of Nulls
No rows returned (*)
All rows that were selected by the inner query including the null values
All rows that were selected by the inner query minus the null values
Section 10 Quiz
(Answer all questions in this section)
1. There can be more than one subquery returning information to the outer query. True or False?
Mark for Review
(1) Points
True (*)
False
Correct Correct
2. Which statement about the ANY operator, when used with a multiple-row subquery, is true? Mark
for Review
(1) Points
The ANY operator compares every value returned by the subquery. (*)
The ANY operator is a synonym for the ALL operator.
The ANY operator can be used with the DISTINCT keyword.
The ANY operator can be used with the LIKE and IN operators.
Incorrect Incorrect. Refer to Section 10 Lesson 3.
3. Which of the following best describes the meaning of the ANY operator? Mark for Review
(1) Points
Compare value to the first value returned by the subquery
Equal to each value in the list
Equal to any member in the list
Compare value to each value returned by the subquery (*)
Correct Correct
4. The salary column of the f_staffs table contains the following values:
4000
5050
6000
11000
23000
Which of the following statements will return the last_name and first_name of those employees who
earn more than 5000?
Mark for Review
(1) Points
SELECT last_name, first_name
FROM f_staffs
WHERE salary IN
(SELECT last_name, first_name FROM f_staffs WHERE salary <5000);
SELECT last_name, first_name
FROM f_staffs
WHERE salary = (SELECT salary FROM f_staffs WHERE salary < 5000);
SELECT last_name, first_name
FROM f_staffs
WHERE salary = (SELECT salary FROM f_staffs WHERE salary > 5000);
SELECT last_name, first_name
FROM f_staffs
WHERE salary IN (SELECT salary FROM f_staffs WHERE salary > 5000);
(*)
Correct Correct
5. Evaluate this SELECT statement that includes a subquery:
SELECT last_name, first_name
FROM customer
WHERE area_code IN
(SELECT area_code
FROM sales
WHERE salesperson_id = 20);
Which statement is true about the given subquery?
Mark for Review
(1) Points
The outer query executes before the nested subquery.
An error occurs if either the inner or outer queries do not return a value.
The results of the inner query are returned to the outer query. (*)
Both the inner and outer queries must return a value, or an error occurs.
Correct Correct
===================================
Section 10 Quiz
(Answer all questions in this section)
6. Which operator or keyword cannot be used with a multiple-row subquery? Mark for Review
(1) Points
= (*)
ALL
>
ANY
Correct Correct
7. You need to display all the players whose salaries are greater than or equal to John Brown’s salary.
Which comparison operator should you use? Mark for Review
(1) Points
>= (*)
>
=
<=
Correct Correct
8. Which of the following statements is a true guideline for using subqueries? Mark for Review
(1) Points
Only one WHERE clause can be used for a SELECT statement, and if specified, it must be the outer
query.
Do not enclose the subquery in parentheses.
Place the subquery on the left side of the comparison condition.
The outer and inner queries can reference more than one table. They can get data from different
tables. (*)
Correct Correct
9. If you use the equality operator (=) with a subquery, how many values can the subquery return?
Mark for Review
(1) Points
Unlimited
Only 1 (*)
Up to 5
Up to 2
Correct Correct
10. In a non-correlated subquery, the outer query always executes prior to the inner query’s
execution. True or False? Mark for Review
(1) Points
True
False (*)
Correct Correct
=============
Section 10 Quiz
(Answer all questions in this section)
11. Which statement about the <> operator is true? Mark for Review
(1) Points
The <> operator CANNOT be used in a single-row subquery.
The <> operator returns the same result as the ANY operator in a subquery.
The <> operator is NOT a valid SQL operator.
The <> operator can be used when a single-row subquery returns only one row. (*)
Correct Correct
12. You need to produce a report that contains all employee-related information for those
employees who have Brad Carter as a supervisor. However, you are not sure which supervisor ID
belongs to Brad Carter. Which query should you issue to accomplish this task? Mark for Review
(1) Points
SELECT *
FROM supervisors
WHERE supervisor_id =
(SELECT supervisor_id
FROM employees
WHERE last_name = ‘Carter’);
SELECT *
FROM supervisors
WHERE supervisor_id =
(SELECT employee_id
FROM supervisors
WHERE last_name = ‘Carter’);
SELECT *
FROM employees
WHERE supervisor_id =
(SELECT employee_id
FROM employees
WHERE last_name = ‘Carter’);
(*)
SELECT *
FROM employees
WHERE supervisor_id = (SELECT supervisor_id
FROM employees
WHERE last_name = ‘Carter’);
Correct Correct
13. The WITH clause is a way of creating extra tables in the database. (True or False?) Mark for
Review
(1) Points
True
False (*)
Correct Correct
14. The Oracle server performs a correlated subquery when the subquery references a column from
a table referred to in the parent. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
15. In a correlated subquery, the outer and inner queries are joined on one or more columns. (True
or False?) Mark for Review
(1) Points
True (*)
False
Section 10 Quiz
(Answer all questions in this section)
1. Which best describes a multiple-row subquery? Mark for Review
(1) Points
A query that returns only one column value from the inner SELECT statement
A query that returns one or more column values from the inner SELECT statement
A query that returns one or more rows from the inner SELECT statement (*)
A query that returns only one row from the inner SELECT statement
Incorrect Incorrect. Refer to Section 10 Lesson 3.
2. Examine the structures of the PARTS and MANUFACTURERS tables:
PARTS:
PARTS_ID VARCHAR2(25) PK
PARTS_NAME VARCHAR2(50)
MANUFACTURERS_ID NUMBER
COST NUMBER(5,2)
PRICE NUMBER(5,2)
MANUFACTURERS:
ID NUMBER PK
NAME VARCHAR2(30)
LOCATION VARCHAR2(20)
Assume that the tables have been populated with data including 100 rows in the PARTS table, and 20
rows in the MANUFACTURERS table. Which SQL statement correctly uses a subquery?
Mark for Review
(1) Points
UPDATE parts SET price = price * 1.15
WHERE manufacturers_id =
(SELECT id
FROM manufacturers
WHERE UPPER(location) IN(“ATLANTA”, “BOSTON”, “DALLAS”));
SELECT parts_name, price, cost
FROM parts
WHERE manufacturers_id IN
(SELECT id
FROM manufacturers m
JOIN parts p
ON (m.id = p.manufacturers_id));
(*)
SELECT parts_name
FROM (SELECT AVG(cost) FROM manufacturers)
WHERE cost > AVG(cost);
SELECT parts_name, price, cost
FROM parts
WHERE manufacturers_id !=
(SELECT id
FROM manufacturers
WHERE LOWER(name) = ‘cost plus’);
Correct Correct
3. Examine the data in the PAYMENT table:
>
>
>
>
PAYMENT_ID CUSTOMER_ID PAYMENT_DATE PAYMENT_TYPE PAYMENT_AMOUNT
86590586 8908090 10-Jun-2003 BASIC 859.00
89453485 8549038 15-Feb-2003 INTEREST 596.00
85490345 5489304 20-Mar-2003 BASIC 568.00
This statement fails when executed:
SELECT payment_date, customer_id, payment_amount
FROM payment
WHERE payment_id =
(SELECT payment_id
FROM payment
WHERE payment_date >= ’05-Jan-2002′ OR payment_amount > 500.00);
Which change could correct the problem?
Mark for Review
(1) Points
Remove the single quotes around the date value in the inner query WHERE clause.
Change the outer query WHERE clause to ‘WHERE payment_id IN’. (*)
Include the PAYMENT_ID column in the select list of the outer query.
Remove the subquery WHERE clause.
Correct Correct
4. When a multiple-row subquery uses the NOT IN operator (equivalent to <>ALL), if one of the
values returned by the inner query is a null value, the entire query returns: Mark for Review
(1) Points
A list of Nulls
All rows that were selected by the inner query including the null values
All rows that were selected by the inner query minus the null values
No rows returned (*)
Correct Correct
5. Evaluate this SELECT statement:
SELECT student_id, last_name, first_name
FROM student
WHERE major_id NOT IN
(SELECT major_id
FROM majors
WHERE department_head_id = 30 AND title = ‘ADJUNCT’);
What would happen if the inner query returned a NULL value row?
Mark for Review
(1) Points
All the rows in the STUDENT table would be displayed.
No rows would be returned from the STUDENT table. (*)
Only the rows with STUDENT_ID values equal to NULL would be displayed.
A syntax error would be returned.
Correct Correct
==============
Section 10 Quiz
(Answer all questions in this section)
6. Evaluate this SQL statement:
SELECT employee_id, last_name, salary
FROM employees
WHERE department_id IN
(SELECT department_id
FROM employees
WHERE salary > 30000 AND salary < 50000);
Which values will be displayed?
Mark for Review
(1) Points
All employees who work in a department with employees who earn more than $30,000 and more
than $50,000.
All employees who work in a department with employees who earn more than $30,000, but less than
$50,000. (*)
Only employees who earn less than $50,000.
Only employees who earn more than $30,000.
Incorrect Incorrect. Refer to Section 10 Lesson 3.
7. Single row subqueries may not include this operator: Mark for Review
(1) Points
>
=
ALL (*)
<>
Correct Correct
8. Which best describes a single-row subquery? Mark for Review
(1) Points
A query that returns one or more rows from the inner SELECT statement
A query that returns one or more column values from the inner SELECT statement
A query that returns only one row from the inner SELECT statement (*)
A query that returns only one column value from the inner SELECT statement
Correct Correct
9. If the subquery returns no rows, will the outer query return any values? Mark for Review
(1) Points
Yes, Oracle will find the nearest value and rewrite your statement implicitly when you run it.
Yes. It will just run and ignore the subquery.
No, because you are not allowed to return empty values from a subquery.
No, because the subquery will be treated like a null value. (*)
Incorrect Incorrect. Refer to Section 10 Lesson 2.
10. A correlated subquery is evaluated _____ for each row processed by the parent statement. Mark
for Review
(1) Points
ONCE (*)
EVERY TIME
COMPLETELY
Incorrect Incorrect. Refer to Section 10 Lesson 4.
Previous Page 2 of 3 Next Summary
===============
wer all questions in this section)
11. Correlated Subqueries must reference the same tables in both the inner and outer queries. (True
or False?) Mark for Review
(1) Points
True
False (*)
Correct Correct
12. The WITH clause enables a SELECT statement to define the subquery block at the start of the
query, process the block just once, label the results, and then refer to the results multiple times. True
or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
13. Examine the structures of the CUSTOMER and ORDER_HISTORY tables:
CUSTOMER
CUSTOMER_ID NUMBER(5)
NAME VARCHAR2(25)
CREDIT_LIMIT NUMBER(8,2)
OPEN_DATE DATE
ORDER_HISTORY
ORDER_ID NUMBER(5)
CUSTOMER_ID NUMBER(5)
ORDER_DATE DATE
TOTAL NUMBER(8,2)
Which of the following scenarios would require a subquery to return the desired results?
Mark for Review
(1) Points
You need to display all the orders that were placed on the same day as order number 25950. (*)
You need to display all the orders that were placed on a certain date.
You need to display each date that a customer placed an order.
You need to display the date each customer account was opened.
Correct Correct
14. Which operator can be used with a multiple-row subquery? Mark for Review
(1) Points
<>
LIKE
=
IN (*)
Correct Correct
15. You need to display all the players whose salaries are greater than or equal to John Brown’s
salary. Which comparison operator should you use? Mark for Review
(1) Points
<=
=
>= (*)
>
Section 10 Quiz
(Answer all questions in this section)
1. Which comparison operator can only be used with a single-row subquery? Mark for Review
(1) Points
IN
ALL
<> (*)
ANY
Incorrect Incorrect. Refer to Section 10 Lesson 2.
2. Single row subqueries may not include this operator: Mark for Review
(1) Points
<>
=
>
ALL (*)
Correct Correct
3. You need to produce a report that contains all employee-related information for those employees
who have Brad Carter as a supervisor. However, you are not sure which supervisor ID belongs to Brad
Carter. Which query should you issue to accomplish this task? Mark for Review
(1) Points
SELECT *
FROM supervisors
WHERE supervisor_id =
(SELECT employee_id
FROM supervisors
WHERE last_name = ‘Carter’);
SELECT *
FROM supervisors
WHERE supervisor_id =
(SELECT supervisor_id
FROM employees
WHERE last_name = ‘Carter’);
SELECT *
FROM employees
WHERE supervisor_id =
(SELECT employee_id
FROM employees
WHERE last_name = ‘Carter’);
(*)
SELECT *
FROM employees
WHERE supervisor_id = (SELECT supervisor_id
FROM employees
WHERE last_name = ‘Carter’);
Correct Correct
4. When a multiple-row subquery uses the NOT IN operator (equivalent to <>ALL), if one of the
values returned by the inner query is a null value, the entire query returns: Mark for Review
(1) Points
All rows that were selected by the inner query minus the null values
A list of Nulls
All rows that were selected by the inner query including the null values
No rows returned (*)
Correct Correct
5. What would happen if you attempted to use a single-row operator with a multiple-row subquery?
Mark for Review
(1) Points
An error would be returned. (*)
No rows will be selected.
All the rows will be selected.
The data returned may or may not be correct.
Correct Correct
========
6. You need to create a SELECT statement that contains a multiple-row subquery. Which comparison
operator(s) can you use? Mark for Review
(1) Points
=, <, and >
BETWEEN?AND?
IN, ANY, and ALL (*)
LIKE
Correct Correct
7. Examine the data in the PAYMENT table:
PAYMENT_ID CUSTOMER_ID PAYMENT_DATE PAYMENT_TYPE PAYMENT_AMOUNT
86590586 8908090 10-Jun-2003 BASIC 859.00
89453485 8549038 15-Feb-2003 INTEREST 596.00
85490345 5489304 20-Mar-2003 BASIC 568.00
This statement fails when executed:
SELECT customer_id, payment_type
FROM payment
WHERE payment_id =
(SELECT payment_id
FROM payment
WHERE payment_amount = 596.00 OR payment_date = ’20-Mar-2003′);
Which change could correct the problem?
Mark for Review
(1) Points
Change the comparison operator to a single-row operator.
Remove the quotes surrounding the date value in the OR clause.
Remove the parentheses surrounding the nested SELECT statement.
Change the outer query WHERE clause to ‘WHERE payment_id IN’. (*)
Correct Correct
8. Which of the following is a valid reason why the query below will not execute successfully?
SELECT employee_id, last_name, salary
FROM employees
WHERE department_id =
(SELECT department_id FROM employees WHERE last_name like ‘%u%’);
Mark for Review
(1) Points
A single, rather than a multiple value operator was used. (*)
First subquery not enclosed in parentheses.
The greater than operator is not valid.
Second subquery found on the right instead of the left side of the operator.
Correct Correct
9. Which comparison operator would you use to compare a value to every value returned by a
subquery? Mark for Review
(1) Points
SOME
ALL (*)
IN
ANY
Incorrect Incorrect. Refer to Section 10 Lesson 3.
10. If you use the equality operator (=) with a subquery, how many values can the subquery return?
Mark for Review
(1) Points
Only 1 (*)
Up to 5
Up to 2
Unlimited
Correct Correct
===================
11. Which operator can be used with subqueries that return only one row? Mark for Review
(1) Points
LIKE (*)
ALL
IN
ANY
Correct Correct
12. What will the following statement return:
SELECT last_name, salary
FROM employees
WHERE (department_id, job_id) = (SELECT department_id, job_id
FROM employees
WHERE employee_id = 103)
Mark for Review
(1) Points
A list of last_names and salaries of employees that works in the same department and has the same
job_id as that of employee 103. (*)
A list of last_names or salaries of employees that works in the same department and has the same
job_id as that of employee 103.
A list of last_names and salaries of employees that works in the same department or has the same
job_id as that of employee 103.
Nothing. It is an invalid statement.
Correct Correct
13. The Oracle server performs a correlated subquery when the subquery references a column from
a table referred to in the parent. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
14. A correlated subquery will _______ a candidate row from an outer query, _______ the inner
query using candidate row value, and _______ values from the inner query to qualify or disqualify
the candidate row. Mark for Review
(1) Points
ROLLUP; GRANT; DROP
CREATE; EXECUTE; USE
DELETE; UPDATE; INSERT
GET; EXECUTE; USE (*)
Incorrect Incorrect. Refer to Section 10 Lesson 4.
15. In a correlated subquery, the outer and inner queries are joined on one or more columns. (True
or False?) Mark for Review
(1) Points
True (*)
False