Skip to Main Content
SQL All-in-One For Dummies, 4th Edition
book

SQL All-in-One For Dummies, 4th Edition

by Allen G. Taylor, Richard Blum
April 2024
Intermediate to advanced content levelIntermediate to advanced
800 pages
18h 34m
English
For Dummies
Content preview from SQL All-in-One For Dummies, 4th Edition

Chapter 3

Querying Multiple Tables with Subqueries

IN THIS CHAPTER

Bullet Defining subqueries

Bullet Discovering how subqueries work

Bullet Nesting subqueries

Bullet Tuning nested subqueries

Bullet Tuning correlation subqueries

Relational databases have multiple tables. That’s where the word relational comes from — multiple tables that relate to each other in some way. One consequence of the distribution of data across multiple tables is that most queries need to pull data from more than one of them. There are a couple of ways to do this. One is to use relational operators, which I cover in the next chapter. The other method is to use subqueries, which is the subject of this chapter.

What Is a Subquery?

A subquery is an SQL statement embedded within another SQL statement. It’s possible for a subquery to be embedded within another subquery, which is in turn embedded within an outermost SQL statement. Theoretically, there is no limit to the number of levels of subquery that an SQL statement may include, although any ...

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

SQL All-In-One For Dummies, 3rd Edition

SQL All-In-One For Dummies, 3rd Edition

Allen G. Taylor
SQL Essentials For Dummies

SQL Essentials For Dummies

Richard Blum, Allen G. Taylor
SQL in a Nutshell, 4th Edition

SQL in a Nutshell, 4th Edition

Kevin Kline, Regina O. Obe, Leo S. Hsu

Publisher Resources

ISBN: 9781394242290Purchase Link