Upload
votram
View
234
Download
1
Embed Size (px)
Citation preview
CSC408 Management Information System Creating Queries
Queries
A query is a request to select specific information from table(s). Queries do not hold any data; they hold or save the criteria used to select the data from the table(s). If the table related to a query is deleted (intentionally or unintentionally) the query will no longer function.
Queries can be used to analyze data, display specific information, and serve as the basic for forms or reports. A query can be used to specify desired fields and criteria to display information from a table, related tables, or other tables.
Queries are different from tables even though the interfaces of tables and queries are very similar to each other. A table must exist before a query or any other database object can be created.
Creating Queries with graphical design facilities in Access DBMS
Creating Query using Query DesignCreating a query in Query Design (Design View) gives the user control over the design of the query including adding or deleting criteria to selected records and sorting results in the record set.
The Query Design window consists of top and bottom pane.
SNI2012 Page 1
CSC408 Management Information System Creating Queries
Field: here we place the field to use which will usually be the field to visualize, it could be a field from the table or a calculated field.
Table: name of the table we want to extract the field from. This will be useful when we are defining queries based on various tables.
Sort: serves to arrange the resulting rows in a determinate order. Show: if not marked, the column does not appear in the result, it is usually unmarked when we
want to use the field to define the query but don't want the field to appear in the result. Criteria: serve to specify the lookup criteria. A lookup criteria is a condition that records need to
comply with to appear in the result of the query. It can be made up from one or from various conditions, joined by AND and OR operators.
or: this row and those after are used to make multiple-conditions.
Example: Total order for each biscuit
SNI2012 Page 2
Top Pane: Write click the top pane in order to view
the show table dialog box.Displays the table(s) used in the query.More than one table can be selected.
Bottom Pane: Specifies the fields used in the query,
criteria to retrieve the desired information, sort parameters in the query (ascending or descending order), and whether a field is displayed when the query is run.
Execute: Click the run symbol in
order to execute the query
CSC408 Management Information System Creating Queries
Example: Searching Single Customer Order
SNI2012 Page 3
Totals: Click the Totals symbol in
order to view the total fields
Output:After execute