Part 1 – Questions on SQL and SQL *Plus
1. Which of the following statements contains an error?
A. SELECT * FROM emp WHERE empid = 493945;
B. SELECT empid FROM emp WHERE empid= 493945;
C. SELECT empid FROM emp;
D. SELECT empid WHERE empid = 56949 AND lastname = 'SMITH';
2. Which of the following correctly describes how to specify a column alias?
A. Place the alias at the beginning of the statement to describe the table.
B. Place the alias after each column, separated by white space, to describe the column.
C. Place the alias after each column, separated by a comma, to describe the column.
D. Place the alias at the end of the statement to describe the table.
3. The NVL function
A. Assists in the distribution of output across multiple columns.
B. Allows the user to specify alternate output for non-null column values.
C. Allows the user to specify alternate output for null column values.
D. Nullifies the value of the column output.
4. Output from a table called PLAYS with two columns, PLAY_NAME and AUTHOR, is shown below.
Which of the following SQL statements produced it?
PLAY_TABLE
-------------------------------------
"Midsummer Night's Dream", SHAKESPEARE
"Waiting For Godot", BECKETT
"The Glass Menagerie", WILLIAMS
A. SELECT play_name || author FROM plays;
B. SELECT play_name, author FROM plays;
C. SELECT play_name||', ' || author FROM plays;
D. SELECT play_name||', ' || author PLAY_TABLE FROM plays;
5. Issuing the DEFINE_EDITOR="emacs" will produce which outcome?
A. The emacs editor will become the SQL*Plus default text editor.
B. The emacs editor will start running immediately.
C. The emacs editor will no longer be used by SQL*Plus as the default text editor.
D. The emacs editor will be deleted from the system.
6. The user issues the following statement. What will be displayed if the EMPID selected is 60494?
SELECT DECODE(empid,38475, ‘Terminated’,60494, ‘LOA’, ‘ACTIVE’)
FROM emp;
A. 60494
B. LOA
C. Terminated
D. ACTIVE
7. SELECT (TO_CHAR(NVL(SQRT(59483), ‘INVALID’)) FROM DUAL is a valid SQL statement.
A. TRUE
B. FALSE
8. The appropriate table to use when performing arithmetic calculations on values defined within the SELECT statement (not pulled from a table column) is
A. EMP
B. The table containing the column values
C. DUAL
D. An Oracle-defined table
9. Which of the following is not a group function?
A. avg( )
B. sqrt( )
C. sum( )
D. max( )
10. The default character for specifying runtime variables in SELECT statements is
A. Ampersand
B. Ellipses
C. Quotation marks
D. Asterisk
Answers:
- Option D
- Option B
- Option C
- Option D
- Option A
- Option B
- Option B
- Option C
- Option B
- Option A
To view explanations for the answers of questions go here.
Don’t miss the explanations for the answers.
End of Part 1