The select statement is the most frequently used SQL statement. It is used to retrieve records from a table or group of tables. In an embedded SQL application, data retrieved by a SELECT statement can be moved directly into a result data set, which is then accessed by a cursor that the application defines, or into one or more application host variables. However, in an ODBC application, data retrieved by a SELECT statement is not actually moved directly into the application. Instead, data is moved into a special storage buffer. Then, other ODBC API functions are responsible for moving it from the storage buffer to the application.
The overall form of the SELECT query is as follows:
SELECT fieldlist
FROM tableexpresion
WHERE searchconditions
GROUP BY fieldlist
HAVING groupcriteria
UNION subquery |tablename
ORDER BY fieldlist
WITH OWNERACCESS OPTION