RSS Feed

Multiple Choice Questions on SQL Subquery

Multiple Choice Questions on SQL Subquery

1. An ORDER BY can be used in a subquery.

A) True
B) False

2. The subquery is known as a ................. subquery because the subquery is related to the outer SQL statement.

A) Relational
B) Related
C) Correlated
D) Corelational

3. A subquery can itself include one or more subqueries. .............. subqueries can be nested in a statement.

A) 16
B) 32
C) 64
D) Any number of

4. In case of correlated subquery the outer query is executed once. The subquery is executed ............. for every row in the outer query.

A) Once
B) Twice
C) Thrice
D) Both A & B

5. The SELECT query of a subquery is always enclosed in parentheses and may only include an ORDER BY clause only when a TOP clause is also specified.

A) True
B) False

6. Below subquery is valid or invalid:

Select (Select 5) As MySubQueryValue;

A) Valid
B) Invalid

7. There cannot be a subquery which is independent of the outer query.

A) True
B) False

8. Below is an example of

SELECT a.EmployeeID
FROM HumanResources.Employee a
WHERE a.ContactID IN
SELECT b.ContactID
FROM Person.Contact b
WHERE b.Title = 'Mrs.'
A) Correlated Subquery
B) Noncorrelated Subquery

9. If a table appears only in a subquery and not in the outer query, then columns from that table can be included in the output.

A) True
B) False

10. A subquery can be used anywhere an expression is allowed.

A) True
B) False