SQL statements
Prev | Chapter 5. Queries | Next

## SQL statements

Create a new query as you did for the QBE-query. You can now change to the SQL window by clicking on the already selected "use QBE"-button.

Figure 5.2. Toggle button to switch between QBE and SQL window

Now you can enter the following SQL-statement into the empty window that is displayed:

    select name,title from authors, literature where author_id=author

and press the "View mode" button on the upper left corner.

The result looks similar to the table you created before, but with only two columns. The difference here is that query results are always read-only.

To save your query click the 'x' in the upper right corner or the 'door-symbol' on the query-window toolbar. A dialog is opened giving you the opportunity to give your query a meaningful name, such as "name-and-title". Confirm your input by pressing the 'OK' button.

### Important

Do not use TRUE or FALSE in your query statements. Use %TRUE% and %FALSE% instead. Some SQL database servers do not support the use of boolean fields, so the hk_classes have to simulate boolean fields. A valid SQL statement would be:

    select * from mytable where myboolfield=%TRUE%

Prev | Up | Next
Chapter 5. Queries | Home | Chapter 6. Forms