O'Reilly logo

SQL Fundamentals, Third Edition by John J. Patrick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required