21.
Which of the following OFFSET-FETCH options are valid in T-SQL? (Choose all that apply.)
- A.SELECT … ORDER BY orderid OFFSET 25 ROWS
- B.SELECT … ORDER BY orderid FETCH NEXT 25 ROWS ONLY
- C.SELECT … ORDER BY orderid OFFSET 25 ROWS FETCH NEXT 25 ROWS ONLY
- D.SELECT …
OFFSET 0 ROWS FETCH FIRST 25 ROWS ONLY
- Answer & Explanation
- Report
Answer : [A, C]
Explanation :
Explanation :
A. Correct: T-SQL supports indicating an OFFSET clause without a FETCH clause. B. Incorrect: Contrary to standard SQL, T-SQL does not support a FETCH clause without an OFFSET clause. C. Correct: T-SQL supports indicating both OFFSET and FETCH clauses. D. Incorrect: T-SQL does not support OFFSET-FETCH without an ORDER BY clause. |
22.
What is the difference between the ON clause and the WHERE clause?
- A.The ON clause uses two-valued logic and the WHERE clause uses three-valued logic.
- B.The ON clause uses three-valued logic and the WHERE clause uses two-valued logic.
- C.In outer joins, the ON clause determines filtering and the WHERE clause determines matching.
- D.In outer joins, the ON clause determines matching and the WHERE clause determines filtering.
- Answer & Explanation
- Report
Answer : [D]
Explanation :
Explanation :
A. Incorrect: Both clauses use three-valued logic. B. Incorrect: Both clauses use three-valued logic. C. Incorrect: ON determines matching and WHERE determines filtering. D. Correct: ON determines matching and WHERE determines filtering. |
23.
Which keywords can be omitted in the new standard join syntax without changing the
meaning of the join? (Choose all that apply.)
- A.JOIN
- B.CROSS
- C.INNER
- D.OUTER
- Answer & Explanation
- Report
Answer : [C, D]
Explanation :
Explanation :
A. Incorrect: The JOIN keyword cannot be omitted in the new syntax for joins. B. Incorrect: If the CROSS keyword is omitted from CROSS JOIN, the keyword JOIN alone means inner join and not cross join anymore. C. Correct: If the INNER keyword is omitted from INNER JOIN, the meaning is retained. D. Correct: If the OUTER keyword is omitted from LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN, the meaning is retained. |
24.
Which syntax is recommended to use for cross joins and inner joins, and why?
- A.The syntax with the JOIN keyword because it’s consistent with outer join syntax and is less prone to errors.
- B.The syntax with the comma between the table names because it’s consistent with outer join syntax and is less prone to errors.
- C.It is recommended to avoid using cross and inner joins.
- D.It is recommended to use only lowercase characters and omit default keywords, as in join instead of INNER JOIN because it increases energy consumption.
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
A. Correct: The syntax with the JOIN keyword is consistent with the only standard
syntax available for outer joins and is less prone to errors. B. Incorrect: Outer joins don’t have a standard syntax based on commas. C. Incorrect: There’s no such recommendation. Cross and inner joins have a reason to exist. D. Incorrect: There’s no such evidence. |
25.
What happens when a scalar subquery returns more than one value?
- A.The query fails at run time.
- B.The first value is returned.
- C.The last value is returned.
- D.The result is converted to a NULL.
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
A. Correct: The query fails at run time, indicating that more than one value is returned. B. Incorrect: The query fails. C. Incorrect: The query fails. D. Incorrect: The scalar subquery is converted to NULL when it returns an empty set—not multiple values. |