Q&A

Q1:Can I use more than one subquery in a single statement?
A1: Yes. In fact, you can use as many subqueries as you like, just as long as you do not exceed the nesting level limit of 32.
Q2:Can I mix subqueries and joins in the same query?
A2: Why not? Some programmers find that doing this helps them understand how the server is actually creating their result set.
Q3:What happens if the subquery I am using returns a null, or if it returns no rows at all?
A3: If a subquery returns a NULL, the outer query will simply compare the specified column to a NULL value. This won't cause an error, but it might not be what you wanted. If the subquery returns no rows (empty set), again, there would be no error, but you would not get any rows back from the ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.