Vous êtes sur la page 1sur 5

Section 2 Quiz

(Answer all questions in this section)


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

Mark for
Review
(1) Points

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?

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- Aug2000';
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.
2. 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
3. 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.
4. The EMPLOYEES table contains these columns:

Mark for

Review
(1) Points

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?

WHERE email IS NULL;


WHERE email IS NOT NULL; (*)
WHERE email = NULL;
WHERE email != NULL;
Correct.
5. 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
Incorrect. See Section 2 Lesson 3.
6. Which
of the
followin
g is
true?

Mark for Review


(1) Points

Character values are not case-sensitive


Date values are enclosed in single quotation marks (*)
Date values are not format-sensitive
Character strings must be enclosed in double quotation marks
Correct
7. 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

The ESCAPE option (\)


The ESCAPE option (\) and one or more percent signs (%) (*)
The (+) operator
A percent sign (%)
Correct.
8. 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.
9. Which of the following commands will display the last name
concatenated with the job ID from the employees table, separated
by a comma and space, and label the resulting column "Employee
and Title"?

Mark for
Review
(1) Points

SELECT last_name||', '|| job_id "Employee and Title" FROM


employees; (*)
SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM
emp;
SELECT " last name" ||', '|| "job_id" + "Employee and Title" FROM
employees;
SELECT last_name||","|| job_id "Employee and Title" FROM
employees;
Correct.
10. Which query would give the following result?
LAST_NAME
FIRST_NAME
DEPARTMENT_ID
King
Steven
90

SELECT last_name, first_name,


FROM employees
WHERE last_name LIKE 'k%';
SELECT last_name, first_name,
FROM employees C
WHERE last_name = 'KING';
SELECT last_name, first_name,
FROM employees
WHERE last_name LIKE 'KING';
SELECT last_name, first_name,
FROM employees
WHERE last_name = 'King';

department_id
department_id
department_id
department_id

Mark for
Review
(1) Points

(*)

Correct
11. When
using
the LIKE
conditio
n to
search
for _
symbol
s, which
charact
er can
you use
as the
default
ESCAPE
option?

Mark for Review


(1) Points

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

IS
WHERE (*)
SELECT
FROM
Correct.
13. Which comparison condition would you use to select rows that
match a character pattern?

Mark for
Review
(1) Points

LIKE (*)
SIMILAR
IN
ALMOST
Correct.

14. The structure of the table can be displayed with the _________
command:

Mark for
Review
(1) Points

Dis
Desc and the Describe (*)
Describe
Desc
Correct
15. In order to eliminate duplicate rows use the ________ keyword

Mark for
Review
(1) Points

EXCLUSIVE
SINGLES_ONLY
DISTINCT (*)
FIRST_ONLY
Correct

Vous aimerez peut-être aussi