|
The US Senate Database: Queries |
|
|
Introduction |
|
A query is a request formulated to a database and the application responds by displaying data that it judges fit for the request. Like a table, a query displays its list as a series of cells created by intersections of columns and rows. This means that a query displays its list as a spreadsheet or a data sheet. A query is equivalent to creating a list of items. The list can be based on one or more fields that already exist(s) on the database or the list can be created with new fields. To create a query, you first decide how its list would be structured. Based on this, there are three types of columns that a query can display:
|
|
Simple Queries |
|
As mentioned above, the simplest query consists of selecting columns from an existing table or another query. To create such a query, you can proceed visually or with code. The easiest way is to use the Query Wizard to select the columns. You can also select items using the Design View of a query. |
|
|
Expressions on Queries |
|
As mentioned earlier, a column of query can be created by combining columns from its parent table. To create such a column, you would write an expression. A simple expression can use only arithmetic operators. A more advanced expression can include Microsoft Access native operators, SQL operators, and/or functions that Microsoft Access can recognize. To create a column that combines other fields from a table or another query, in Design View, after displaying the table or query that holds the list of columns, in the top box of the desired column, you can type the appropriate expression. Normally, then expression should have a name that would be displayed on the column header. If you don't provide such a string, Microsoft Access would add a string such as Expr1 or Expr2, etc. Otherwise, you can provide your own name or label. It must preceded the expression and followed by a colon. |
|
|
Relations-Based Queries |
|
While tables are used to lay a valuable foundation for the flow of information among objects, queries can take very advantage of the relationships that have been created. Like all other objects, a query can use an already established relationship between fields of two tables. Based on this, you can create a query that combines fields from one or more tables or combining other, existing queries. |
|
|
|
||
| Previous | Home | Next |
|
|
||