Chapter 18. If-Then-Else, Parameter Queries, and Subqueries

This chapter discusses three important topics that do not fit into the framework of the rest of the book. The first topic discusses if-then-else logic. Oracle implements this with the decode function. Access uses the Immediate If (iif) function. These functions do not introduce any new power into SQL, but they make some queries easier to write.

The second topic is parameter queries. This type of query asks you some questions before it runs. For example, it might ask, “What are the beginning and ending dates?” The answers you provide are used to modify the SQL, so the result is tailored to your needs.

The last topic is subqueries. When one query is written inside another query, it is called ...

Get SQL Fundamentals, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.