Microsoft Access – Tutorial 3

Slides:



Advertisements
Similar presentations
Lesson 30: Maintaining a Database. Learning Objectives After studying this lesson, you will be able to:  Change the layout of a table by adjusting column.
Advertisements

Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT ACCESS Lesson 4 – Finding and Ordering Data.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 2 Querying a Database Using the Select Query Window.
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.
COMPREHENSIVE Access Tutorial 2 Building a Database and Defining Table Relationships.
Querying a Database Microsoft Office Access 2003.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
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.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 3 Maintaining a Database Using the Design and Update Features of Access.
Access Tutorial 3 Maintaining and Querying a Database
Microsoft Access – Tutorial 1 if you need to review general Microsoft Office procedures such as: menus toolbars task panes files help printing please go.
Define Table Relationships—1 of 3 One of the most powerful features of a relational database management system, such as Access, is its ability to define.
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.
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Access Tutorial 2 Building a Database and Defining Table Relationships
Microsoft Access – Tutorial 1 if you need to review general Microsoft Office procedures such as: menus toolbars task panes files help printing please go.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
Microsoft Access – Tutorial 2 Designing Databases In this tutorial, we will create a new database create a new table import tables from an existing database.
McGraw-Hill/Irwin ©2009 The McGraw-Hill Companies, All Rights Reserved Business Driven Information Systems 2e Plug-In T6: Basic Skills and Tools Using.
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.
® Microsoft Office 2010 Access Tutorial 2 Building a Database and Defining Table Relationships.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T8: Decision Making Using Access 2007 Business Driven Technology.
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
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.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Creating Related Tables Creating Related Tables Determining.
® Microsoft Access 2010 Tutorial 3 Maintaining and Querying a Database.
1 After completing this lesson, you will be able to: Change the format of a table. Sort records in a table. Find records in a table Use filters with a.
McGraw-Hill/Irwin © The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T6 Basic Skills Using Access.
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.
Pasewark & Pasewark 1 Access Lesson 3 Creating Queries Microsoft Office 2007: Introductory.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
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.
BA271 Week 6 Lecture Dave Sullivan. Goal for today… Status Report – Review where we are … Status Report – Review where we are … Begin learning about Microsoft.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
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.
Microsoft Access – Tutorial 3 Performing Calculations copy the HighWageAmounts query and paste it name it HighWageAmountsWithBonus and open it in Design.
Work with Tables and Database Records Lesson 3. NAVIGATING AMONG RECORDS Access users who prefer using the keyboard to navigate records can press keys.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
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.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
Maintaining a Database Using the Design and Update Features of Access
Maintaining a Database
Microsoft Access – Tutorial 3
Access Tutorial 3 Maintaining and Querying a Database
Microsoft Access – Tutorial 3
Microsoft Office Access 2003
Tutorial 3 – Querying a Database
Microsoft Office Access 2003
Access Tutorial 2 Building a Database and Defining Table Relationships
Assignment 3 Querying and Maintaining a Database
Presentation transcript:

Microsoft Access – Tutorial 3 Querying a Database a query is a question you ask about data stored in a database you tell Access what fields you need and what criteria Access should use to select the records ex. find records for employers located in a specific State or Province queries allow you to: display selected fields and records from a table sort records perform calculations generate data for forms, reports and other queries update data in the tables in a database find and display data from two or more tables

Microsoft Access – Tutorial 3 Query by Example (QBE) You Query by Example by giving Access an example of the information we are requesting Access then retrieves the information we are requesting We want to create a query to display: employer ID employer name city contact first name contact last name web site information for each record in the Employer table

Microsoft Access – Tutorial 3 Query by Example (QBE) open the Northeast database we created last week (I have included a copy in the Common Directory on the desktop) Click Create > Query Design show the Employer Table and the close the Show Table dialog box maximize the Query window

Microsoft Access – Tutorial 3 Query by Example (QBE) you will see the field list in a box entitled Employer (the table name) you can double-click or drag fields to the design grid in the design grid, you include the fields and record selection criteria for the information that you want to see you can see the current results of your query at any time by View button or the Run button on the top left the current results will appear in a datasheet view

Microsoft Access – Tutorial 3 Query by Example (QBE) drag the split bar and resize the windows as you like double-click the following fields in order: EmployerID, EmpoyerName, City, ContactFirstName, ContactLastName and Website note the checkbox that that allows you to show or hide fields click Run (or View (Datasheet View)) to see the results in a datasheet click the View button to return to Design View click the Save button on the toolbar and name the query EmployerAnalysis

Microsoft Access – Tutorial 3 Updating Data using a Query return to the Datasheet view indicate that The Adele Bannister House (10135) now has a website change the Contact person for Alpine Touring Center (10152) to Mary Grant close the Query and note that it has been added to the Queries in the Objects bar open the Employers table and verify that the changes have been made close the Employers table

Microsoft Access – Tutorial 3 Table Relationships remember that Access is a relational database management system relationships are created among tables by using common fields this process is often called a join when you join tables with a common field, you can extract data from them as if they were one table the Employer and Position tables will be joined with the common field EmployerID (a foreign key) you can use a query form or report to extract selected data from each table even though the information is in two tables

Microsoft Access – Tutorial 3 One-to-Many Relationships a one-to-many relationship exists between two tables when one record in the first table matches zero, one or many records in the related table and when one record in the in the second table matches exactly one record in the first table the primary table is the one table in the one-to-many relationship this is the Employer table the related table is the many table this is the Position table

Microsoft Access – Tutorial 3 One-to-Many Relationships orphaned records can be created when inconsistencies occur between tables for example: if an Employer ID is changed in the Employer table if an Employer is deleted from the Employer table if a position is added for an Employer that doesn’t exist in the Employer table

Microsoft Access – Tutorial 3 One-to-Many Relationships Referential Integrity is a set of rules that Access uses to prevent records from being orphaned it maintains consistency between tables when you update data when you add a record to a related table, a matching record must already exist in the primary table if you attempt to change the value of a primary key in the primary table, Access prevents the change if matching records exist in a related table (however, if the cascade updates option is chosen, the foreing key values will be updated automatically) Access prevents the deletion of records in a primary table if matching records exist in a related table (if cascade deletes option is selected all records with that key will be deleted – this is not recommended)

Microsoft Access – Tutorial 3 Defining Relationships you can define relationships between tables using the Relationships window Database Tools > Relationships add Employer and Position and close the Show Table dialog box lengthen and widen each window to show all fields click and drag EmployerID from the Employer Table to EmployerID in the Position table the Edit Relationships window will appear the Primary Table, Related Table and Common Field will be visible

Microsoft Access – Tutorial 3 Defining Relationships check Enforce Referential Integrity note that the two Cascade options become available check Cascade Update Related Fields (remember that it is not recommended to check the Cascade Delete Related Records as you may inadvertently delete records) click create and note the join line that appears and the symbols on it now create a one-to-many relationship between the NAICS table and Employer Table with NAICS code as the common field (foreign key) click the Save button and Close the window

Microsoft Access – Tutorial 3 Multi-Table Queries now that we have created Relationships among (joined) our tables, we can query them as one create a new query in design view add the Employer and Position tables create a query in the following order: EmployerName City StateProv Openings PositionTitle StartDate EndDate run it and save the query as EmployerPositions

Microsoft Access – Tutorial 3 Sorting Data in a Query sorting is rearranging records in a specified order or sequence open the EmployerPositions query in datasheet view select the first record in the Employer Name field and use the sort buttons (drop-down arrows on column heading) to sort alphabetically to sort by more than one field go to Design View select the entire column for Openings click and drag it so that it is the last field (after EndDate) use the Sort field to sort PositionTitle Ascending sort Openings Descending run the query within groups of fields with the same Position Title, the record sorts the number of openings from highest to lowest save the query

Microsoft Access – Tutorial 3 Filtering Data in a Query you can filter query results using the Filter by Selection button double-click the word clerk in one of the Position Title records click the Filter by Selection button (located in Home > Sort and Filter group > selection) you will see only results for different kinds of clerks click the toggle filter button to turn off the filter filter results for New Hampshire (NH) Untoggle the filter and close the query

Microsoft Access – Tutorial 3 Defining Record Selection Criteria you can specify a condition which is a criteria or rule that tells Access which records to display we will Create > Query Wizard using a condition click Simple Query Wizard and make sure the Table: Position is selected add all the fields by clicking >> remove both PositionID and EmployerID from the Selected Fields list box to add fields from another table after the current set of fields, select Openings now add EmployerName, StateProv, ContactFirstName, ContactLastName and Phone from the Employer Table

Microsoft Access – Tutorial 3 Defining Record Selection Criteria click the Next button make sure the Detail radio button is selected and click Next again name the Query HousekeepingPositions and click the Modify the Query Design radio button and click Finish in the PositionTitle Criteria type housekeeping Access adds “ signs before and after the criteria run and save the query only housekeeping positions will be displayed

Microsoft Access – Tutorial 3 Formatting the Appearance of the sheet select all the records Home > Font Size (in the Font group) change the size of the fonts to 8 double click between columns to resize them

Microsoft Access – Tutorial 3 Setting Range Criteria open the HousekeepingPositions query in Design View remove the PositionTitle criteria set the Wage criteria >=17 run the query and Save (Office Button > Save As) it As HighWageAmounts

Microsoft Access – Tutorial 3 Using Multiple Selection Criteria with the And operator open the HousekeepingPositions query in Design View add MA as criteria for StateProv run the Query and you’ll see results that match both criteria close and save the query right click on the Query July1Positions in the Query window rename it MAJuly1Positions

Microsoft Access – Tutorial 3 Using Multiple Selection Criteria with the Or operator create a new query in Design view use the Employer and Position tables and add the following fields: EmployerName, City, PositionTitle, HoursPerWeek, and Experience set the HoursPerWeek criteria to <30 in order to select records in which either (not both) of the conditions is met type Yes in the or: field run the query sort it alphabetically ascending by Employer Name Save it as HoursorExperience