Introduction to Queries |
|
Introduction |
A query is the result of getting or isolating a list of values from a table or another query. Querying is the technique of examining data to create a dependent list. You can perform querying on a table, a form, or a query. Microsoft Access provides various means of performing such an operation visually. As an alternative, Microsoft Access supports SQL that allows you to query a database using code. There are various ways you create a query in Microsoft Access. |
The simplest way to create a query is by using the Query Wizard. It presents a list of tables and queries you can select from the current database. To use the Query Wizard, on the Ribbon, you can click the Create tab and, in the Other section, click Query Wizard . This would display the New Query dialog box: On the New Query dialog box, you can click Simple Query Wizard and click OK. The first page of the Simple Query Wizard expects you to choose the origin of the query as a table or an already created query. After selecting the table or query, the second page of the wizard would present the fields of that list and you can select those you want:
The next page of the wizard allows you to specify the name of the query:
Like other objects of a database, a query can be designed. You design a query using the Design View:
This would display the Show Table dialog box that allows you to specify the table or query that holds the fields you want to use in the intended query
If the Show Tables dialog box is closed or for any reason you want to display it:
When a query is displaying in Design View, the Design tab of the Ribbon displays the buttons used for a query:
The Query window allows you to design and manage various aspects of a query. You can right-click the title bar of the Query window to access a menu: One of the operations you can perform on the Query window consists of resizing its top and bottom sections by dragging the splitter bar up or down:
To create the fields for a query, you use the table(s) or query( queries) displayed in the upper section of the window. Once you have decided on the originating object(s), you can select which fields are relevant for your query:
To make a field participate in a query, you have various options:
To execute a query:
If you manually write a SQL statement and want to execute it, change the view to Datasheet View.
Some operations require that you select a column from the bottom section of the query window:
Since selecting a column in the Query window is a visual operation, there is no equivalent in SQL.
As seen above, a query is built by selecting columns from the originating list and adding them. If you do not need a column anymore on a query, which happens regularly during data analysis, you can either delete it or replace it with another column:
To replace a column, click the arrow on the combo box that displays its name and select a different field from the list:
Columns on a query are positioned incrementally as they are added to it. If you do not like the arrangement, you can move them and apply any sequence of your choice. Before moving a column or a group of columns, you must first select it. Then:
You can perform data entry on a query. To do this, display it in Datasheet View, click the desired cells and type the information as necessary.
You can print the record of a query. To do this:
|
|
||
Home | Copyright © 2008-2016, FunctionX, Inc. | |
|