Simple Queries

Top  Previous  Next

The following examples highlight typical searches that are possible within 1 database table e.g. the Patients table.

Example 1: Find all patients aged 45.

1.Select Open > Patients.
2.Click OK to get rid of the Search window if it appears.
3.Select Records > Search.
4.Click on the Age field in the field list on the left.
5.Click on "is equal to" in the comparisons list on the right
6.Type "45" in the Value field. The window should now look like this:

Age45Query

 

Note: The upper pane contains the finished query.

 

7.Click the Query button. (The Query button will remain disabled until you have entered a valid query.)

 

All the patients aged 45 will be displayed.

Example 2: Find all male patients aged between 45 and 50.

1.Select Open > Patients.
2.Click OK to get rid of the Search window if it appears.
3.Select Records > Search.
4.Click on the Age field in the field list on the left.
5.Click on "is greater than or equal to" in the comparisons list on the right.
6.Type "45" in the Value field.
7.Click on the Add Line button.
8.Click on the Age field again in the field list on the left.
9.Click on "is less than or equal to" in the comparisons list on the right
10.Type "50" in the Value field.
11.Click on the Add Line button.
12.Click on the Sex field in the field list on the left.
13.Click on "is equal to" in the comparisons list on the right
14.Type "m" in the Value field.
15.Click the Query button.

 

All males aged between 45 and 50 (inclusive) will be displayed.

Example 3: Find all patients aged between 45 and 50 whose first name is either "John" or "Jon".

After performing the search in Example 2:

1.Select Records > Search.
2.Click on the First Name field in the field list on the left.
3.Click on "is equal to" in the comparisons list on the right
4.Type "John" in the Value field.
5.Click on the Add Line button.
6.Click on the Or button in the lower left of the window.
7.Click on the First Name field again in the field list on the left.
8.Click on "is equal to" in the comparisons list on the right
9.Type "Jon" in the Value field.
10.Click the Query in Selection button, which will search only the list of patients aged between 45 and 50 rather than the whole database.

Query

Example 4: Find all patients whose first name is "John" who live in "Main" Street.

1.Select Open > Patients.
2.Click OK to get rid of the Search window if it appears.
3.Select Records > Search.
4.Click on the First Name field in the field list on the left.
5.Click on "is equal to" in the comparisons list on the right
6.Type "John" in the Value field.
7.Click on the Add Line button.
8.Click on the Address Line 1 field in the field list on the left.
9.Click on "contains" in the comparisons list on the right
10.Type "Main" in the Value field.
11.Click the Query button.

Example 5: Find all patients whose first name is "John" who don't live on Main Street.

1.Select Open > Patients.
2.Click OK to get rid of the Search window if it appears.
3.Select Records > Search.
4.Click on the First Name field in the field list on the left.
5.Click on "is equal to" in the comparisons list on the right
6.Type "John" in the Value field.
7.Click on the Add Line button.
8.Click on the Except button in the lower left of the window,
9.Click on the Address Line 1 field in the field list on the left.
10.Click on "contains" in the comparisons list on the right
11.Type "Main" in the Value field.
12.Click the Query button.