Selecting Data
One way to select data from a database is to use an RWDBReader to read a database table (See Reading Tables: Class RWDBReader.) In SQL terms, this is equivalent to:
 
SELECT * FROM table-name
This technique works well as long as we want to read all the rows and all the columns of a single table. Naturally, your applications must do much more than this very simple form of SELECT. You need an encapsulation of the relational concepts of projection, restriction, and join, as well as special features like ordering and grouping. You may also want to select things other than simple column values. In SQL these features are supported by the SELECT statement. In the DB Interface Module, the equivalent is the RWDBSelector.
Each RWDBSelector instance is an encapsulated SELECT statement. Its methods provide your application with explicit control over the SELECT statement's select list, as well as its FROM, ON, HAVING, WHERE, ORDER BY, and GROUP BY clauses. The set operators +, *, and -, which represent union, intersection, and difference, respectively, may be applied to several RWDBSelector instances in order to achieve the semantics of the UNION, INTERSECTION, and DIFFERENCE operations as defined by standard SQL. Because RWDBSelector instances may be used as expressions, subqueries are also supported.
Class RWDBSelector supports the full range of functionality built into the SQL SELECT statement. This means it has many member functions and operators, which are explained in detail in the SourcePro API Reference Guide. This chapter covers the basic concepts.