Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Chapter 4 Joins: Retrieving Data from Several
Tables [Table of Contents] Chapter 6 Using and Creating
Datatypes

Transact-SQL User's Guide

[-] Chapter 5 Subqueries: Using Queries Within Other Queries

Chapter 5

Subqueries: Using Queries Within Other Queries

A subquery is a select statement that is nested inside another select, insert, update, or delete statement, inside a conditional statement, or inside another subquery.

You can also express subqueries as join operations. See Chapter 4, "Joins: Retrieving Data from Several Tables."

[-] How subqueries work
Subquery syntax
Subquery restrictions
Example of using a subquery
Qualifying column names
Subqueries with correlation names
Multiple levels of nesting
Subqueries in update, delete, and insert statements
Subqueries in conditional statements
Using subqueries instead of expressions
[-] Types of subqueries
[+] Expression subqueries
[+] Quantified predicate subqueries
Subqueries used with in
Subqueries used with not in
Subqueries using not in with NULL
Subqueries used with exists
Subqueries used with not exists
Finding intersection and difference with exists
[-] Using correlated subqueries
Correlated subqueries containing Transact-SQL outer joins
Correlated subqueries with correlation names
Correlated subqueries with comparison operators
Correlated subqueries in a having clause


Determining which table columns to join [Table of Contents] How subqueries work