Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Quiz 2.

2 Database Programming
14 januari 2017oleh sheghet45, posted in materi
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 (*)

Incorrect Incorrect. See Section 2 Lesson 3.


Previous Page 3 of 3 Summary
==========

You might also like