Compose SELECT statements
The SELECT statement is the most important and the most complex SQL statement. You can use it and the SQL statements INSERT, UPDATE, and DELETE to manipulate data. You can use the SELECT statement to retrieve data from a database, as part of an INSERT statement to produce new rows, or as part of an UPDATE statement to update information.
The SELECT statement is the primary way to query information in a database. It is your key to retrieving data in a program, report, form, or spreadsheet. You can use SELECT statements with a query tool such as or embed SELECT statements in an application.
This chapter introduces the basic methods for using the SELECT statement to query and retrieve data from relational databases. It discusses how to tailor your statements to select columns or rows of information from one or more tables, how to include expressions and functions in SELECT statements, and how to create various join conditions between database tables. The syntax and usage for the SELECT statement are described in detail in the HCL OneDB™ Guide to SQL: Syntax.
Most examples in this publication come from the tables in the stores_demo database, which is included with the software for your HCL OneDB SQL API or database utility. In the interest of brevity, the examples show only part of the data that is retrieved for each SELECT statement. For information on the structure and contents of the demonstration database, see the HCL OneDB Guide to SQL: Reference. For emphasis, keywords are shown in uppercase letters in the examples, although SQL is not case sensitive.