Select Statement
Select Statement
Select Statement
SELF TEST
The following questions will help you measure your understanding of the material presented in this
chapter. Read all the choices carefully because there might be more than one correct answer. Choose
all the correct answers for each question.
The following test is typical of the questions and format of the OCP 11g examination for the topic
Retrieving Data using the SQL SELECT Statement. These questions often make use of the Human
Resources schema.
D. The expression is invalid since arithmetic cannot be performed on columns with DATE
data types.
E. The expression represents the days between the END_DATE and START_DATE less one
day.
4. The DEPARTMENTS table contains a DEPARTMENT_NAME column with data type
VARCHAR2(30). (Choose two true statements about this column.)
A. This column can store character data up to a maximum of 30 characters.
B. This column must store character data that is at least 30 characters long.
C. The VARCHAR2 data type is replaced by the CHAR data type.
D. This column can store data in a column with data type VARCHAR2(50) provided that the
contents are at most 30 characters long.
7. Which expressions do not return NULL values? (Choose all that apply.)
A. select ((10 + 20) * 50) + null from dual;
B. select 'this is a '||null||'test with nulls' from dual;
C. select null/0 from dual;
D. select null||'test'||null as Test from dual;
8. Choose the correct syntax to return all columns and rows of data from the EMPLOYEES table.
A. select all from employees;
B. select employee_id, first_name, last_name, first_name, department_id
from employees;
C. select % from employees;
D. select * from employees;
E. select *.* from employees;
9. The following character literal expression is selected from the DUAL table:
SELECT 'Coda''s favorite fetch toy is his orange ring' FROM DUAL;
(Choose the result that is returned.)
A. An error would be returned due to the presence of two adjacent quotes
B. Coda's favorite fetch toy is his orange ring
C. Coda''s favorite fetch toy is his orange ring
D. 'Coda''s favorite fetch toy is his orange ring'
10. There are four rows of data in the REGIONS table. Consider the following SQL statement:
SELECT '6 * 6' Area FROM REGIONS;
How many rows of results are returned and what value is returned by the Area column?
(Choose the best answer.)
A. 1 row returned, Area column contains value 36
B. 4 rows returned, Area column contains value 36 for all 4 rows
C. 1 row returned, Area column contains value 6 * 6
D. 4 rows returned, Area column contains value 6 * 6 for all 4 rows
E. A syntax error is returned.
LAB QUESTION
In this chapter you worked through examples in the Human Resources schema. Oracle provides a
number of example schemas for you to experiment with and to learn different concepts from. For the
practical exercises, you will be using the Order Entry, or OE, schema. The solutions for these exercises
Lab Question 95
will be provided later using SQL Developer. Using SQL Developer or SQL*Plus, connect to the OE
schema and complete the following tasks.