|
Sample queries |
Top Previous Next |
|
Sample queries:
Queries using SQL represents an extremely powerful and flexible method of dealing with database. With queries, you can extract just about anything from your databases, based upon any collection of conditions, including conditions relating one table with another. You can present the results in any order. You can perform any function, such as globally changing variables (updating the database), summing columns, and such. The drawback is that queries are confusing to write. To help, sample queries are presented here. You can cut and paste these into the query box, and modify them as your needs be.
After writing a query, when you press any of the buttons, the query is saved in the clipboard and the registry. You can press ^V to paste it, if you wish to use the query again with some modifications. You can come back the next day and press the Use Saved button to recall the query.
You can select a query from this window using the mouse, ^C to copy it to the clipboard, and then ^V to paste it in the query. That is, you can use these examples.
When you Open successfully a query, it is saved to a file on the hard disk. You can view these old queries, and reuse them. Software reuse is an important part of good design.
Queries look like tables when you see them on the screen. The difference is that they reside in memory, not on the hard disk, as do tables. The query is lost when the program closes, while the tables reside on the hard disk.
Queries usually begin with the word select, unless you want to perform an action (such as updating or summing).
The next word of the query refers to the table. For example, the query that starts with "select * from checks ..." means that the checks table is being accessed. There are two databases (sets of tables) in this program. One dealing with banks (checks, ch_fi, etc. tables), and the other with information (info table). Query|New Query will permit opening a bank query, but not an info query. Likewise, InfoTable|Query will permit a info query, but not a repository query. When you run a query, it is saved in the registry, and can be recalled later. Each database query (banks or info) are saved separately.
Queries refer to the fields of the tables. For example, the table checks has fields repository, account, dates, etc. For each table in this database, the Help|Fields will give the fields. These field names must be copied with the correct spelling in order for the query to work.
|