You are on page 1of 6

Section 2

(Answer all questions in this section)


1. 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
WHERE salary >= 2500 AND salary <= 3500(*)

WHERE salary <=2500 AND salary >= 3500


WHERE salary BETWEEN 2500 AND 3500(*)

WHERE salary BETWEEN 3500 AND 2500


Correct

2. 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 (*)
Correct

3. 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 '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'; (*)
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';
Correct.

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

5. 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 and6. 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
AND
LIKE (*)
IN
BETWEEN
Correct.
7. 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 team_id, DISTINCT manager_id FROM players;
SELECT team_id, manager_id DISTINCT FROM players;
SELECT team_id, manager_id FROM players;
SELECT DISTINCT team_id, manager_id FROM players; (*)
Correct.

8. 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 FROM employees; (*)
SELECT manager_id, DISTINCT department_id FROM employees;
SELECT manager_id, department_id DISTINCT FROM employees;
Correct.

9. 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
Correct

10. You want to determine the orders that have been placed by customers
who reside in the city of Chicago. You write this partial SELECT statement:
SELECT orderid, orderdate, total
FROM orders;

What should you include in your SELECT statement to achieve the desired
results?

Mark for Review

(1) Points
WHERE city = Chicago;
WHERE city = 'Chicago'; (*)
AND city = 'Chicago';
AND city = Chicago;
Correct.
low value. True or False?
Mark for Review

(1) Points
True
False (*)
Correct.
11. The concatenation operator ...
Mark for Review

(1) Points
Brings together columns or character strings into other columns
Creates a resultant column that is a character expression
Is represented by two vertical bars ( || )
All of the above (*)
Correct

12. The structure of the table can be displayed with the _________


command:
Mark for Review

(1) Points
Desc and the Describe (*)
Describe
Dis
Desc
Correct

13. You need to display only unique combinations of the LAST_NAME and


MANAGER_ID columns in the EMPLOYEES table. Which keyword should you
include in the SELECT clause?
Mark for Review

(1) Points
DISTINCT (*)
ONLY
UNIQUEONE
DISTINCTROW
Correct.

14. 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
Putting a space between first name and last name
Concatenating first name, middle name and last name (*)
Using a column alias
Incorrect. See Section 2 Lesson 1.

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
^
\ (*)
%
&
Correct.

You might also like