The SQL Select Statement Questions
The SQL Select Statement Questions
A. Projection
B. Selection
C. Data Control
D. Transaction
Answer: A, B. The SELECT statement can be used for selection, projection and joining.
2. Determine the capability of the SELECT statement demonstrated in the given query.
A. Selection
B. Filtering
C. Joining
D. Projection
Answer: A, C, D. Projection is including only the required columns in query, while Selection is
selecting only the required data. Joining means combining two tables together through a
connecting column.
A. INTERSECT
B. DUPLICATE
C. DISTINCT
D. UNIQUE
Answer: C, D. Duplicate data can be restricted with the use of DISTINCT or UNIQUE in the SELECT
statement.
4. Chose the statements which correctly specify a rule to write a SQL statement
SELECT '5+7'
FROM dual;
A. 12
B. 5+7
C. 5
D. 7
Answer: B.Oracle treats the values within double quotes as string expressions.
6. Write a query to display employee details Name, Department, SalaryandJob from EMP table.
Answer A.Select the required from the tables each separated by a comma.
7. Which of the below queries displays employees' name and new salary after the
increment of 1000?
Answer: C. Basic arithmetic calculations can be done using the columns in SELECT statements.
A. 130
B. -32
C. -120
D. 175
A. 0.294
B. -85
C. 63.67
D. 85
Answer: D. Expression within the brackets are executed before the divisions and multiplications
in the expression.
Answer: B, D.NULL is NO VALUE but neither same as zero nor as blank or space character.
A. sal + NULL
B. NULL
C. 0
D. 1250
Answer: A, D. Column Alias can be used to name an expression in the SELECT statement.
13. Specify the column alias NEWSAL for the expression containing salary in the below
SQL query
14. Specify the column alias "New Salary" for the expression containing salary in the
below SQL query
Answer: B, D. Column alias with space and special characters must be enquoted within double
quotes.
A. LIST
B. SHOW
C. DESCRIBE
D. STRUCTURE
16. Predict the output when below statement is executed in SQL* Plus?
DESC emp
A. Raises error "SP2-0042: unknown command "desc emp" - rest of line ignored."
B. Lists the columns of EMP table
C. Lists the EMP table columns, their data type and nullity
D. Lists the columns of EMP table along with their data types
Answer: C. DESCRIBE is used to show the table structure along with table columns, their data type
and nullity
17. Which of the below statements are true about the DESCRIBE command?
Answer: B.
18. Which of the below alphanumeric characters are used to signify concatenation
operator in SQL?
A. +
B. ||
C. -
D. ::
19. Which of the below statements are correct about the usage of concatenation
operator in SQL?
A. SMITH
B. SMITH NULL
C. SMITHNULL
D. ORA-00904: "NULL": invalid identifier
Answer: A. Concatenation with NULL results into same value.
SELECT 50 || 0001
FROM dual
A. 500001
B. 51
C. 501
D. 5001
Answer: C. The leading zeroes in the right operand of expression are ignored by Oracle.
And get the exception - ORA-01756: quoted string not properly terminated. Which of
the following solutions can permanently resolve the problem?
Answer: B. The [q] operator is used to enquote character literals with a quote.
23. Which of the below SELECT statement shows the correct usage of [q] operator?
Answer: A
24. Which of the below SELECT statement is used to select all columns of EMP table?
Answer: C. The character '*' is used to select all the columns of the table.
25. Which of the below SQL query will display employee names, department, and annual
salary?
D. Annual salary cannot be queried since the column doesn't exists in the table