The SELECT statement is arguably the most important statement in the whole Structured Query Language. It is the only statement of the data query language (DQL) and provides the means for extracting data.
This chapter introduces the important concepts of a single table SELECT query and all its component clauses — SELECT, FROM, and WHERE.
The query only extracts data and modifies the extract, it never modifies the data in the underlying tables. The operations on the resultsets generally follow the rules of the mathematical set theory, the basic knowledge of which is beneficial for understanding the results.
The queries could be combined into a single resultset using the UNION, INTERSECT, or EXCEPT operations. Some of these results are implemented differently by different RDBMS vendors.
Subqueries can be used as a part of a general SELECT query and can be nested in order to dynamically retrieve information that is difficult or impossible to obtain otherwise.