ms-access by sangeetha parthasarathy topics covered understanding different types of queries...

17
MS-ACCESS BY SANGEETHA PARTHASARATHY

Upload: rebecca-montgomery

Post on 04-Jan-2016

219 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

MS-ACCESS

BY

SANGEETHA

PARTHASARATHY

Page 2: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Topics Covered

• Understanding different types of Queries

• Creating a Query• Creating a Query using a Wizard• Changing Fields in a Query• Retriving selective records• Creating a Query to summarize

values• Display a query in design view

Page 3: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Understanding different types of Queries

• Select Query :This retrives and displays records in the Table window in Datasheet View.

• Crosstab Query : This displays summarized values(sums,count,average) from one field in a table and groups them by one set of fields in the left side of datasheet and another set of fields listed across the top of the datasheet.

• Action Query:`This performs operations that match the criteria.

Cont

Page 4: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

• Action Queries : There are four kinds of queries. (I) Delete Queries-Delete matching records from atable (ii) Update Queries-Make changes to matching records in a table (iii) Append Queries-Add new records to the end of the table (records not matching your criteria are added to the table) (iv) Make-Table Queries - Create new tables based on matching records.

• Parameter Query: Allows you to prompt for a single piece of information to use as selection criteria in the query. For example: To find customer information in each state, we could enter state as a parameter to retrieve the records.

Page 5: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Creating a Query• In the Database Window,click Queries tab,and then Click

New.

• In the New Query Dialog box,click Design view,and then click OK.

• Select the table or Query containing the records you want to retrieve.

• Click Add.

• Click Close to display the query in Design view.

• In the field list at the top part of the design view window,double-click each field you want to include.

• In the Design grid,enter search criteria in the Criteria box.

• Click the Sort drop-down arrow to specify a sort order for the records.

• Click the Save button on the Query Design Toolbar,type a name to save the query.

Page 6: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Create a Query using a Query Wizard

• In the Queries tab in the Database Window,Click New button and Click the Wizard that corresponds to your kind of query.

• Click the Table/Queries drop down arrow and select a table with fields to include in the query.

• Click each available field that has to included and click Add button(>). To include all,Click Add All(>>).

• Click Next to continue.

• If you have selected numeric fields and want a summary of it, Click Summary Options to specify the calculation for the field.

• Click Next to continue.

• In the final wizard dialog box,type the name of the query.

• Click an option to view the query results or display the query in Design view.

• Click Finish.

Page 7: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Add a Field to a Query

• Display the query in Design view.

• In the field list at the top of the Design view window,double-click a field name to place the field in the next available column in the design grid, or click and drag a field to a specific column in the design grid.

Page 8: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Remove a Field from Query

• Display the Query in Design View.

• Select the field by clicking its column selector and press Delete. When you remove a field from a query design grid you are only removing it from the query specifications and not from the underlying table.

Page 9: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Add a Field from Another Table to a Query• Display the query in Design view.• Click the Show Table button on the

Query Design Toolbar.• Select the table that contains the fields

you want to include in the query.• Click Add.• Click Close.• Double-click or drag the fields you want

to include to the design grid.

Page 10: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Retrieving records with Criteria

• Display the query in Design view.

• Click the Criteria box for the field for which you want to define a selection criteria.

• Type the first criterion you want for the Query.

Page 11: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Expand the Criteria with OR

• Display the Query in Design View.

• In the Criteria row, type the first criteria you want for the query.

• For each additional OR criteria,enter the criteria in a separate “or” row for the field.

Page 12: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Restrict Criteria with an AND condition

• Display the query in Design view.

• In the Criteria row, enter the first criteria you want for the query.

• In the same Criteria row, enter the additional AND Criteria for the other field(s) in the query.

Page 13: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Create a Parameter Query to Prompt you a Criteria

• Display the Query in Design view.• Click the Criteria box for the field for which

you want to be prompted to enter a value.• Type the text of your prompt surrounded by

square brackets.• Click the Run Button on the Query Design

Toolbar.• Enter the criteria information.• Click OK.

Page 14: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Create a Crosstab Query• From the Queries tab in the Database

Window,Click New,Click Crosstab Wizard, and then click OK.

• From the list at the top of the dialog box,select the table or query that contains the records you want to retrieve,and then click Next.

• Select the fields for the rows in the Crosstab Query, and then Click Next.

• Select the field for the columns in the Crosstab Query, and then click Next.

Cont

Page 15: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

• In the Fields box,click the field whose values you want to be calculated and displayed for each row and column intersection.

• In the Functions box,click the function you want for the calculation to be performed.

• Click the check box if you want to see a total for each row, or clear the check box if you do not want to see a total for each row.

• Click Next to display the final Crosstab Query Wizard dialog box.

• Type a name for your Query.• Click Finish.

Page 16: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Change to Design View from the Database Window

• In the Database Window,select the Query whose design you want to use.

• Click Design.

Page 17: MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing

Switch Between Design and Datasheet View

• In Design View,click the View button on the Query Design Toolbar.

• In Datasheet view,click the View button on the Table Datasheet Toolbar.