Creating Queries
When you choose to create a query, it is recommended that you use the New Query Wizard. After completing the wizard, the query can be edited at any time. If at any point you do not decide to complete the wizard, click on the Cancel button, and confirm that you do not want to design a query. SELECT TABLE The first Query Wizard dialog box that appears gives you a list of tables and allows you to choose the table against which you will make the query.
After selecting the table, click on the Next button to progress to the dialog box following.
The second wizard dialog box allows you to select the columns against which you wish to query.
The Available Columns list box contains a list of columns belonging to the table that you selected. After highlighting a column, the Comparison operator must be selected. The Comparison types available to you in the Comparison pull-down menu are in Appendix A. After selecting a column and the Comparison operator, you must enter a value or values against which the column will be compared. The Value or values can be user-defined or you can use the Value pull-down menu next to the value text box to use another column from the selected table.
Once the query is complete, click on the Add button to add it to the list of queried columns. You may create more queries and add them, and you may remove queries by highlighting them and clicking on the Remove button. After selecting the table, click on the Next button to progress to the dialog box following.
The third wizard dialog box allows you to select the query precedence and define the order in which the queries are performed.
The third Query Wizard dialog box that appears gives you a list of the queries that you have created. Now, you have the ability to optimise the selection criteria. Two tools will allow you to do this. The first tool allows you to group queries using parentheses. In addition, you can change the And/Or logic of the selection criteria. And logic is used by default, double-clicking on the logic toggles the value. See Appendix B for examples. The second tool allows you reorder the selected query columns, thus giving the columns an order of precedence. The columns are queried from top to bottom, so records are filtered in the order of the columns. To change the order of the columns, click on the Reorder Selection Criteria button. The following dialog box will open:
The Current Order list box contains a list of the selected query columns. Highlight a column from this list box and click on the Add button to include this column in the New Order list box. This action puts the column at the bottom of the New Order list box. To undo a selection, highlight a column in the New Order list box and click on the Remove button. When all of the columns are in the New Order list box, click on the OK button. After organising the selection criteria, click on the Next button to progress to the dialog box following. The forth wizard dialog box allows you to select columns by which the output of the query will be sorted. All of the table's columns are available for selection.
To sort the output by a column, select it in the Available Columns list and click on the Add button. The column will appear in the Sort By list and will have a green arrow pointing upwards in the icon. This indicates that the column will be sorted in ascending order. To sort a column in descending order, click on the Descending check box then select the column as explained before. The icon will appear with a red arrow pointing downwards. To undo the selection of a column, select it in the Sort By list, then click on the Remove button. The Remove All button will remove all of the columns from the Sort By list. After sorting the output columns, click on the Next button to progress to the dialog box following. The penultimate wizard dialog box lets you enter the query name (which must be unique) and the description of the query.
After entering the query name and description, click on the Next button to progress to the final dialog box. The final dialog box simply indicates that you have completed the wizard. Click on the Finish button to complete the Wizard.
There are two situations where you can edit queries:
The query properties dialog box consists of three tabs:
QUERY DETAILS TAB This tab shows the query name and description. This information is editable.
This tab shows the query selection criteria. This information is editable by way of adding and removing queried columns and by reordering selection criteria. (See SELECT COLUMNS and SELECT CRITERIA PRECEDANCE AND ORDER in "Designing Queries")
This tab shows the columns by which the output of the query is sorted. This information is editable.
(See SORTING OUTPUT BY COLUMNS in "Designing Queries")
|
| Copyright © 2005 The Sprezzatura Group. All rights reserved. |