Day 6

Quiz

1:How many tables can appear in a single query?
A1: In previous releases of SQL Server, there was a limit of 16 tables. However, Microsoft has increased this limit to 256, which is probably more than any query you write will ever need.
2:Can a subquery be run as a join or vice versa?
A2: Yes, in most cases, a subquery can be implemented as a join or vice versa.
3:In which SQL clauses may a subquery appear?
A3: A subquery can be used in any SELECT, WHERE, and HAVING statement or clause.

Exercises

These exercises use the Pubs database.

1:List the authors who have at least one book priced above the average price.
A1: This one is a bit harder than it looks. To answer it, you must use the Authors table to get the author names, the Sales table ...

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.