Download Queries

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Database wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Relational algebra wikipedia , lookup

SQL wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Microsoft Access wikipedia , lookup

Clusterpoint wikipedia , lookup

SAP IQ wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database model wikipedia , lookup

Relational model wikipedia , lookup

Versant Object Database wikipedia , lookup

Transcript
11.1 Queries
• Query
– One of the objects in Microsoft Access
– It can help users extract data, which meets the criteria defined
by them, from a database file.
– It must be written in a specific format.
– Microsoft Access provides different tools to help users compose
a query.
– After a query is submitted, Microsoft Access looks up the
database and displays the requested data.
The idea of a query
11.1 Queries
– Although a filter can help us find records that meet
certain criteria, we can only obtain one set of filtered
records from a table at a time.
– The result cannot be further processed.
– If we want to store and process the results after
execution, queries should be used.
The results of filtering
cannot be stored for
further processing.
11.1 Queries
– Although a filter can help us find records that meet
certain criteria, we can only obtain one set of filtered
records from a table at a time.
– The result cannot be further processed.
– If we want to store and process the results after
execution, queries should be used.
The results of filtering
cannot be stored for
further processing.
11.2 Creating Queries
– Ways to create a query in Microsoft Access:
 Using Design View
 Simple Query Wizard
 Crosstab Query Wizard
11.2 Creating Queries
• Using Design View to Create Queries
– In the Design View, users can define queries with
selection criteria and sorting method to retrieve and
arrange the required data from more than one table.
Extracting data with a query
11.2 Creating Queries
• Criteria of a Query
– In a query, criteria can be treated as the rule of
retrieving data from a table.
– The following table shows the usage of wildcard * and
some logical operators which can be used for setting
criteria in a query.
11.2 Creating Queries
• Criteria of a Query
Symbol
Description
Example
*
Wildcard
like ‘*D’
like ‘A*’
=
Exact match
= 100
= ‘Hong Kong’
>
Greater than
>0
>’A’
>=
Greater than or equal to
>= 1/1/2007
<
Less than
< 100
<=
Less than or equal to
<= 100
<>
Not equal to
<>’A’
Wildcard and logical operators used for setting criteria in a query
11.2 Creating Queries
• Creating Queries with Simple Query
Wizard
– The Simple Query Wizard is another tool for creating
queries in Microsoft Access.
– In the process of generating a query, the Simple Query
Wizard prompts users with a series of questions and
then generates the required queries based on the
responses of users.
– The Simple Query Wizard does not allow users to define
their own criteria.
11.2 Creating Queries
• Creating Queries with Simple Query
Wizard
– The generated queries can be further modified in the
Design View.
– The Simple Query Wizard can also create a summary
query.
– A summary query is useful when we want to obtain
statistical information such as the total sales amount
and the average salary.
11.2 Creating Queries
• Creating Queries with Simple Query
Wizard
– The generated queries can be further modified in the
Design View.
– The Simple Query Wizard can also create a summary
query.
– A summary query is useful when we want to obtain
statistical information such as the total sales amount
and the average salary.