Skip to Main Content
Beginning T-SQL
book

Beginning T-SQL

by Kathi Kellenberger, Scott Shaw
August 2014
Beginner content levelBeginner
496 pages
12h 26m
English
Apress
Content preview from Beginning T-SQL

CHAPTER 6

image

Building on Subqueries, Common Table Expressions, and Unions

The most common way to use more than one table in a query is by joining them, which you learned about in Chapter 5. This chapter will explain several other ways to combine tables in a query. Subqueries and common table expressions (CTE) allow you to isolate the logic of complex queries. Union queries allow you to combine the results of two independent queries into one result set. The first thing you will learn in this chapter is how to substitute a query for a hard-coded IN list.

Writing Subqueries

This section demonstrates using subqueries in the WHERE clause. A subquery ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

T-SQL Fundamentals, 4th Edition

T-SQL Fundamentals, 4th Edition

Itzik Ben-Gan
Learning SQL

Learning SQL

Ben Forta

Publisher Resources

ISBN: 9781484200469Purchase book