Database Programming With SQL - Teacher - English - Quiz - Section 2
Database Programming With SQL - Teacher - English - Quiz - Section 2
Section 2 Quiz
(Answer all questions in this section)
1.Which two statements would select salaries that are greater than or equal to 2500
Mark for Review
and less than or equal to 3500? (Choose two)
(1) Points
Correct
Correct
3.If you write queries using the BETWEEN operator, it does not matter in what
Mark for Review
order you enter the values, i.e. BETWEEN low value AND high value will give
(1) Points
the same result as BETWEEN high value and low value. True or False?
True
False (*)
Correct.
4.Which of the following WHERE clauses would not select the number 10?
Mark for Review
(1) Points
Correct
5.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.
Correct.
Page 1 of 3
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 2 Quiz
(Answer all questions in this section)
(*)
SELECT first_name ||' '||last_name NAME, department_id DEPARTMENT,
salary*12 'ANNUAL SALARY'
FROM employees
WHERE last_name = 'King';
SELECT first_name ||' '||last_name NAME, department_id DEPARTMENT,
salary*12 'ANNUAL SALARY'
FROM employees
WHERE name = 'King';
Correct
7. You need to display all the values in the EMAIL column that contains the
Mark for Review
underscore (_) character as part of that email address. The WHERE clause in
(1) Points
your SELECT statement contains the LIKE operator. What must you include in
the LIKE operator?
The ESCAPE option (\) and one or more percent signs (%) (*)
The (+) operator
The ESCAPE option (\)
A percent sign (%)
Correct.
How will the heading for the FIRST_NAME column appear in the display by
default in Oracle Application Express?
The heading will display with the first character capitalized and centered.
The heading will display as uppercase and centered. (*)
The heading will display as uppercase and left justified.
The heading will display with the first character capitalized and left
justified.
Correct.
9. If the EMPLOYEES table has the following columns, and you want to write a
Mark for Review
SELECT statement to return the employee last name and department number for
(1) Points
employee number 176, which of the following SQL statements should you use?
Name Type Length
EMPLOYEE_ID NUMBER 22
FIRST_NAME VARCHAR2 20
LAST_NAME VARCHAR2 25
EMAIL VARCHAR2 25
PHONE_NUMBER VARCHAR2 20
SALARY NUMBER 22
COMMISSION_PCT NUMBER 22
MANAGER_ID NUMBER 22
DEPARTMENT_ID NUMBER 22
(*)
SELECT first_name, employee_id
FROM employees
WHERE employee_id = 176;
SELECT last_name, employee_id
FROM employees
WHERE employee_id equals 176;
Correct.
10.You want to determine the orders that have been placed by customers who
Mark for Review
reside in the city of Chicago. You write this partial SELECT statement:
(1) Points
SELECT orderid, orderdate, total
FROM orders;
What should you include in your SELECT statement to achieve the desired
results?
Correct.
Page 2 of 3
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 2 Quiz
(Answer all questions in this section)
Correct
12.Which comparison condition would you use to select rows that match a
Mark for Review
character pattern?
(1) Points
ALMOST
IN
LIKE (*)
SIMILAR
Correct.
Correct.
14.When using the LIKE condition to search for _ symbols, which character can
Mark for Review
you use as the default ESCAPE option?
(1) Points
%
^
\ (*)
&
Correct.
15.You need to display employees whose salary is in the range of 10000 through
Mark for Review
25000 for employees in department 50 . What does the WHERE clause look
(1) Points
like?
WHERE department_id = 50
AND salary BETWEEN 10000 AND 25000
(*)
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
Correct.
Page 3 of 3