You can use a query to view a subset of your data or to answer questions about your data. For example, if you want to view a list of student names and.

Slides:



Advertisements
Similar presentations
Databases Section 4: Select Queries Presented By: Lindani Ncube Based on Materials by: M Halse.
Advertisements

1 After completing this lesson, you will be able to: Create a database. Create a table using the Table Wizard. Create and modify a table in Design view.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT ACCESS Lesson 4 – Finding and Ordering Data.
Access Tutorial 3 Maintaining and Querying a Database
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 3 1 Microsoft Office Access 2003 Tutorial 3 – Querying a Database.
Microsoft Access 2003 Introduction To Microsoft Access 2003.
Querying a Database Using the Select Query Window
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
Querying a Database Microsoft Office Access 2003.
QUERYING A DATABASE By: Dr.Ennis-Cole. OBJECTIVES: Learn how to use the Query window in Design view Create, run and Save queries Define a relationship.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 1 1 Microsoft Access 2003 Tutorial 1 – Introduction To Microsoft Access 2003.
Microsoft Access 2010 Chapter 7 Using SQL.
Access Tutorial 3 Maintaining and Querying a Database
Access Tutorial 10 Automating Tasks with Macros
Chapter 2 Querying a Database
1 Access Lesson 3 Creating Queries Microsoft Office 2010 Introductory Pasewark & Pasewark.
1 Access Lesson 3 Creating Queries Microsoft Office 2010 Introductory.
Chapter 3 Maintaining a Database
Maintaining and Querying a Database Microsoft Access 2010.
XP New Perspectives on Microsoft Access 2002 Tutorial 41 Microsoft Access 2002 Tutorial 4 – Creating Forms and Reports.
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
Working with a Database
Chapter 6 Generating Form Letters, Mailing Labels, and a Directory
Lesson 2.  To help ensure accurate data, rules that check entries against specified values can be applied to a field. A validation rule is applied to.
1 By: Nour Hilal. Microsoft Access is a database software where data is stored in one or more Tables. A Database is a group of related Tables. Access.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 7 BACKNEXTEND 7-1 LINKS TO OBJECTIVES Filtering Data Removing a Filter Filter by Selection.
XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003.
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics to be covered §Comparing Values in Selection Criteria §Calculating Values in a Query §Changing the appearance.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
Analyzing Data Using Access. Creating a new database To create a new database 1.Start Access. In the Task Pane, click Blank Database. 2.The File New Database.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
Lesson 1: Exploring Access Learning Objectives After studying this lesson, you will be able to: Start Access and identify elements of the application.
SESSION 3.1 This section covers using the query window in design view to create a query and sorting & filtering data while in a datasheet view. Microsoft.
Filtering Data A filter is a set of restrictions you place on the records of an open datasheet or form to temporarily isolate a subset of the records.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
® Microsoft Office 2013 Access Creating a Database.
® Microsoft Access 2010 Tutorial 3 Maintaining and Querying a Database.
COMPREHENSIVE Access Tutorial 3 Maintaining and Querying a Database.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
® Microsoft Office 2013 Access Maintaining and Querying a Database.
1 After completing this lesson, you will be able to: Create and run a query. Specify criteria in a query. Create a calculated field. Create a multiple-table.
® Microsoft Access 2010 Tutorial 10 Automating Tasks with Macros.
Microsoft Access 2000 Presentation 3 Creating Databases Part II (Creating Forms)
You can sort Access data so you can view records in the order you want to view them, and you can filter data so you only see the records you want to see.
1 Lesson 18 Managing and Reporting Database Information Computer Literacy BASICS: A Comprehensive Guide to IC 3, 3 rd Edition Morrison / Wells.
MS-Access XP Lesson 4. Modifying Queries 1.Select query in queries 2.Click design button or Right click on query and click design view 3.Change query.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT ACCESS Lesson 4 – Finding and Ordering Data.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
1 Access Lesson 2 Creating Queries, Forms, and Reports Microsoft Office 2007 Fundamentals Story / Walls.
Excel part 5 Working with Excel Tables, PivotTables, and PivotCharts.
Key Applications Module Lesson 22 — Managing and Reporting Database Information Computer Literacy BASICS.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 2 ® Building Queries.
Access Queries and Forms. Adding a New Field  To insert a field after you have saved your table, open Access, and open the table  It is easier to add.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
1 Access Lesson 2 Creating Queries, Forms, and Reports Microsoft Office 2010 Fundamentals Story / Walls.
Access Maintaining and Querying a Database
Lesson 23 Managing and Reporting Database Information
Access Tutorial 3 Maintaining and Querying a Database
Access Maintaining and Querying a Database
Microsoft Office Access 2003
Creating and Modifying Queries
Tutorial 3 – Querying a Database
CIS16 Application Programming with Visual Basic
Chapter 9 Lesson 2 Notes.
Microsoft Office Access 2003
Creating a simple query in the Design View
Assignment 3 Querying and Maintaining a Database
Presentation transcript:

You can use a query to view a subset of your data or to answer questions about your data. For example, if you want to view a list of student names and addresses, but you do not want to see addresses and other data, you can create a query that displays the student’s first name, last name, and address only. Alternatively, if you want to know which students live, you can restrict your list to those students. A query can be based on tables or on other queries. To create a query, you open the tables or queries on which you are going to base your query in Query Design view, and then use the options in Design view to create your query. 1.Activate the Create tab. 2.Click the Query Design button in the Other group. The Show Table dialog box appears. 3.Activate the Tables tab if you want to base your query on tables, activate the Queries tab if you want base your query on queries or activate the Both tab if you want to base your query on both tables and queries. 4.Click to choose the table or query on which you want to base your query. 5.Click Add. The table appears in the window. 6.Click Close. Access changes to Query Design view. 1.Activate the Create tab. 2.Click the Query Design button in the Other group. The Show Table dialog box appears. 3.Activate the Tables tab if you want to base your query on tables, activate the Queries tab if you want base your query on queries or activate the Both tab if you want to base your query on both tables and queries. 4.Click to choose the table or query on which you want to base your query. 5.Click Add. The table appears in the window. 6.Click Close. Access changes to Query Design view.

In Query Design view, each table has an option that allows you to display all of the fields and all of the records in a table. This option appears on the field line on the drop-down menu as the table name followed by a period and an asterisk (tablename.*). 1.Open a table or query in Query Design view. 2.Click the down-arrow in the first field on the Field row and then select the tablename.* option. The table name appears on the table line. 3.Click the Run button. Access retrieves all of the fields and records for the table and displays them in Datasheet view. 1.Open a table or query in Query Design view. 2.Click the down-arrow in the first field on the Field row and then select the tablename.* option. The table name appears on the table line. 3.Click the Run button. Access retrieves all of the fields and records for the table and displays them in Datasheet view.

After you run a query, you can easily change back to Query Design view and make modifications to your query or create a new query. 1.Activate the Home tab. 2.Click the down-arrow below View in the Views group. A menu appears. 3.Click Design View. Access changes to Query Design view. You can modify your query. 1.Activate the Home tab. 2.Click the down-arrow below View in the Views group. A menu appears. 3.Click Design View. Access changes to Query Design view. You can modify your query.

You can use an Access query to retrieve a single column of data. Instead of choosing the tablename.* option on the Field line in Query Design view, choose the name of the field you want to retrieve. 1.Open a table or query in Query Design view. 2.Choose the field name you want to display in the field line. 3.Click the Run button. Access retrieves the column you chose. 1.Open a table or query in Query Design view. 2.Choose the field name you want to display in the field line. 3.Click the Run button. Access retrieves the column you chose.

As you learned in the previous section, you can sort the rows your query returns. You can also create sorts within a sort. For example, you can sort by state and then within a state, you can sort by last name and then by first name. You specify the sort in the order you want the sort to occur. If you want to sort by state and then by last name within a state and then by first name within last name, you enter the sort in the following order: city, last name, first name. Your sort order may not agree with the order in which you want to display fields. In such a case, you can use fields that do not display to enter your sort order. To prevent a field from displaying, deselect the Show box on the Show row. 1.Open a table or query in Query Design view. 2.Choose the field names. 3.Under the fields you want to sort by, choose Ascending or Descending. 4.Deselect the Show button for the columns you do not want to display. 5.Click the Run button. 1.Open a table or query in Query Design view. 2.Choose the field names. 3.Under the fields you want to sort by, choose Ascending or Descending. 4.Deselect the Show button for the columns you do not want to display. 5.Click the Run button.

Logical operations

You can apply multiple criteria to the same table. If you place two criteria on the same line, Access will only retrieve records where both criteria are met. For example, if you want all records where the State is equal to "DE" and the Last Name is equal to Smith, you would set the State field to = "DE" and the Last Name field to = "Smith" and you would place both criteria on the same line. If you place one set of criteria on the Criteria line and the second set of criteria on the Or line, Access will retrieve records if either criteria are met. For example, you want all records where the State is equal to "DE" or the Last Name is equal to Smith. You would set the State field to = "DE" and the Last Name field to = "Smith" and you would place one set of criteria on the Criteria line and the other set of criteria on the Or line. Access will bring back all records where the state equals DE and all records where the Last Name is equal to Smith no matter what the State is. You can add additional and and or statements by using the lines below the Or line. For And clauses, place the criteria on the same line; for Or clauses, place the criteria on separate lines. 1Open a table or query in Query Design view. 2Choose the field names. 3Choose the field names. 4Under the fields you want to sort by, choose Ascending or Descending. 5Enter your selection criteria on the Criteria line and the Or line, as needed. 6Deselect the Show button for columns you do not want to display. 7Click the Run button. Access retrieves the columns you chose and displays the rows in the order you specified. 1Open a table or query in Query Design view. 2Choose the field names. 3Choose the field names. 4Under the fields you want to sort by, choose Ascending or Descending. 5Enter your selection criteria on the Criteria line and the Or line, as needed. 6Deselect the Show button for columns you do not want to display. 7Click the Run button. Access retrieves the columns you chose and displays the rows in the order you specified.

After you create a query, you can save it. You can rerun a saved query at any time. If you change the data on which the saved query is based, you will see the changes when you rerun the query. 1Click the Save button on the Quick Access toolbar. Access saves the query unless you are saving for the first time. If you are saving for the first time, the Save As dialog box appears. 2Type the name you want to give your query. 3Click OK. Access saves the query. You can now access the query by using the Navigation pane. 1Click the Save button on the Quick Access toolbar. Access saves the query unless you are saving for the first time. If you are saving for the first time, the Save As dialog box appears. 2Type the name you want to give your query. 3Click OK. Access saves the query. You can now access the query by using the Navigation pane.