Microsoft Access A Hands-On Introduction Chapter 3.

Slides:



Advertisements
Similar presentations
Microsoft Office Illustrated Fundamentals Unit K: Working with Data.
Advertisements

An Introduction to Forms (continued). The Major Steps of a MicroSoft Access Database  Tables  Queries  Forms  Macros  Reports  Modules On our road.
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.
BA271 Week 6 Lecture Database Overview Dave Sullivan.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making.
SUNY Morrisville-Norwich Campus-Week 10 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
Microsoft Access 2003 Introduction To Microsoft Access 2003.
Querying a Database Using the Select Query Window
Querying a Database Microsoft Office Access 2003.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 1 1 Microsoft Access 2003 Tutorial 1 – Introduction To Microsoft Access 2003.
Management Information Systems MS Access 2003 By: Mr. Imdadullah Lecturer, Department of M.I.S. College of Business Administration, KSU.
Build a database IV: Create queries for a new Access database Overview: Ask your data — create queries It’s time to create queries, one of the most powerful.
Access Tutorial 3 Maintaining and 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.
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-1 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left,
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
Database Applications – Microsoft Access Lesson 9 Designing Special Queries.
With Microsoft Office 2007 Introductory© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Introductory.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
1 Chapter 7 Query-By-Example by Monica Chan CS157B Professor Lee.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
PgP MIS 202 Access Overview 1 Microsoft Access Introduction to Relational Databases Powerful tool to collect and analyze business data, facilitates decision-
Analyzing Data For Effective Decision Making Chapter 3.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
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 ® Access ® 2010 Training Create Queries for a New Database If a yellow security bar appears at the top of the screen in PowerPoint, click Enable.
Office Management Tools II Ms Saima Gul.  When you create your tables, you should assign each table a primary key—one or more fields whose contents are.
XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003.
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
Database Systems Microsoft Access Practical #3 Queries Nos 215.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the 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.
Part II. Query Types On the design query table pane, right click and the cascading window will appear.
CSC 240 (Blum)1 Introduction to Data Entry, Queries and Reports.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
Maintaining a Database Access Project 3. 2 What is Database Maintenance ?  Maintaining a database means modifying the data to keep it up-to-date. This.
Microsoft Access. Microsoft access is a database programs that allows you to store retrieve, analyze and print information. Companies use databases for.
Pasewark & Pasewark 1 Access Lesson 3 Creating Queries Microsoft Office 2007: Introductory.
Database Applications – Microsoft Access Lesson 4 Working with Queries 36 Slides in Presentation.
O FFICE M ANAGEMENT T OOL - II B BA -V I TH. Abdus Salam2 Week-7 Introduction to Query Introduction to Query Querying from Multiple Tables Querying from.
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.
CHAPTER 1 – INTRODUCTION TO ACCESS Aliya Farheen March 5, 2014.
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.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/All Programs/Microsoft Office/Microsoft Office.
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 Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at
Objectives Query for top values Create a parameter query
Microsoft Office Illustrated Fundamentals
Microsoft Office Access 2003
Tutorial 1 – Introduction To Microsoft Access 2003
Tutorial 3 – Querying a Database
Tutorial 1 – Introduction To Microsoft Access 2003
Microsoft Office Access 2003
New Perspectives on Microsoft
Presentation transcript:

Microsoft Access A Hands-On Introduction Chapter 3

2 Establishing Relationships  A relationship is a link between two tables that establishes an association between fields in the two tables.  The requirement is that the link must be between compatible data.  Relationships are what differentiate tables in Relational Databases from flat files.  They are also the mechanism by which queries can provide us with answers to questions such as “What is the total dollar amount of Genoa Salami I purchased in July” or “How many unpaid invoices are there for customer 55317”.

3 Types of Relationships  One to one.  - For each record in the Employee table, there is one record in the Payroll table.  Not frequently used, however very useful in some circumstances.

4 Types of Relationships (Contd.)  One-to-many.  - Most common type.  For each record on the one side there can be zero, one or more records on the many side.  Created by linking the Primary key on the one side to a compatible field(s) on the many side. The linked field on the many side is sometimes called the Foreign Key.

5 Types of Relationships (Contd.)  Many-to-many.  - Less common than one- to- many.  Actually occurs via two one-to-many.  In the example shown, would allow us to create a query to determine what movies are in Category “Action” as well as what are the categories for the movie “101 Dalmatians”.

6 Creating Relationships  We will now open the Microsoft Access sample database and use the Relationships window to create relationships between several tables.  It is typical when designing and creating a database, that all relationships are created prior to populating the tables. There are several reasons for this that we will discuss shortly.  Please follow along with your instructor as we use the Nwind database and learn how this is done.

7 Referential Integrity  Ensures that an order record cannot be added unless there is a parent in the Customers table.  Ensures that a Customer record cannot be deleted if there are child records in the Orders table.  The overall goal is to protect against accidental data loss.  Also ensures against having orphaned records.

8 Referential Integrity (contd.)  The Cascade Delete checkbox if checked causes the deletion of records on the many side if the parent record on the one side is deleted.  If Cascade Update is checked, Access will update the matching foreign key value if the Primary key value is changed in the parent record. This option is used infrequently as changing foreign keys is not a good idea.

9 Using the Datasheet  The Datasheet is a built in tool for viewing, adding and updating data. Please follow along with your instructor as we explore its capabilities.

10 Using the Datasheet (Contd.)  Now that we have seen what can be accomplished with the Datasheet, let’s take it for a test drive.  First, let’s try sorting in descending sequence on Unit Price. What is our most expensive item?  Next, let’s sort on the Category field ascending. How many Produce items do we sell?  Who can tell me how many different items are sold in boxes?  Let’s change the price of Filo Mix to $8.00. What happened to the Record Pointer icon when you made the change?  Click anywhere in the Reorder Level field. What do you see in the lower left of the Status Bar?  Finally, add several new records to the Products table.

11 Using the Datasheet (Contd.)  As you have seen, the Datasheet is great for viewing data due to it’s ability to do sorting and filtering.  Another benefit of the Datasheet is the ability to get a broad picture of your data since many records are displayed at once. This benefit however tends to make doing record maintenance more difficult since you can easily lose track of where you are.  Later, we will work on designing forms which are a much better tool for doing data maintenance and additions.

12 What is a Query?  A Query is a request to your database to return specific information from one or more of it’s tables.  Below is a screenshot of the Query By Example window that asks the question “What customers do I have in Madrid Spain?”  The four field names at the bottom were selected from the Customers table field list at the top.  Note that the Title Bar states that this is a Select Query. Select Queries are the most common.

13 What is a Query? (Contd.)  Below are the results of our Select Query which has been returned as something called a Recordset.  A Recordset is a collection of one or more rows of data that looks like a table. We see only four fields because that is what we requested from the Customers table.  A Recordset is a very frequently used object in Access and we will be seeing more on them later.

14 What is a Query? (Contd.)  By selectively choosing what you want to see, you only get records returned that match the Criteria that you specified.  In effect, we have filtered out what we wished to see and removed what we did not want to see.  Our Recordset is a separate object from the Customers table although it is considered a logical view of certain rows in the table.  In this case, all the information we needed came from one table. Sometimes however, the information we need comes from more than one table and may even come from more than one database.

15 Other things we can do with Select Queries  Sorting the results on one or more fields.  Perform calculations. For example, calculating total cost by multiplying Unit Cost by Quantity Ordered.  Creating a field called MiddleInitial by extracting the first letter of the MiddleName field.  Select Queries are also frequently used as a data source for other Access objects such as forms, reports and even other queries.  Queries are arguably the most important feature of Relational Databases.

16 Types of Queries  Select queries - Most commonly used query - Most commonly used query - Returns a Recordset which is updatable - Returns a Recordset which is updatable - Usually displayed in Datasheet format - Usually displayed in Datasheet format - Commonly used as input for forms and reports - Commonly used as input for forms and reports  Action queries - Queries that update tables, delete rows from tables, append data to tables and also make new tables - Queries that update tables, delete rows from tables, append data to tables and also make new tables  Crosstab queries - Data summarization - Data summarization  SQL Specific queries

17 Types of Action Queries  Make-Table Query - Creates a new table from one or more existing tables. For example: Create a Paid Invoice table from the current Invoice table by selecting all records where the AmountPaid field equals the AmountOwed field. - Creates a new table from one or more existing tables. For example: Create a Paid Invoice table from the current Invoice table by selecting all records where the AmountPaid field equals the AmountOwed field.  Delete Query - Deletes all records that match a set of Criteria. - Deletes all records that match a set of Criteria.  Append Query - Appends to an existing table, records that match a set of Criteria. - Appends to an existing table, records that match a set of Criteria.  Update Query - Updates records based on a set of Criteria. - Updates records based on a set of Criteria.

18 SQL Specific Queries  Union query - Combine matching fields from two or more tables. - Combine matching fields from two or more tables.  Passthrough queries - Sends SQL commands directly to an ODBC data source. Allows direct SQL specific connection with a Client Server database. - Sends SQL commands directly to an ODBC data source. Allows direct SQL specific connection with a Client Server database.  Data-definition query - Queries that deal with database structure, not with data tables. These types of queries are typically used only by Database Administrators. - Queries that deal with database structure, not with data tables. These types of queries are typically used only by Database Administrators.

19 Working with Select Queries  Selecting ranges of records - Choose the range you wish to see - Choose the range you wish to see - Define the Criteria (= <> = Between … And) - Define the Criteria (= <> = Between … And) - Additional Criteria with And, Not, Or - Additional Criteria with And, Not, Or - Sorting - Sorting

20 Working with Select Queries (Contd.)  This is a multi-table query in the sample Nwind database  Notice that all the tables have join lines. These indicate Relationships and are necessary for the query to work.

21 Using Expressions in Queries  Expressions are a combination of symbols, identifiers, operators and values that together produce a result. - Examples - Examples [Quantity] * [UnitCost] [Quantity] * [UnitCost] [TotalCost] + [Freight] [TotalCost] + [Freight]  Expressions can be used in queries as Criteria. - Examples - Examples Between #1/1/1997# And #12/31/1997# Between #1/1/1997# And #12/31/1997# >”L” >”L”  Expressions can also be used in queries to create fields. - Examples - Examples MiddleInitial: (Left([Middlename],1)) MiddleInitial: (Left([Middlename],1)) DueDate: ([ShippedDate]+30) DueDate: ([ShippedDate]+30)

22 Additional Criteria Examples  The “Like” operator shown here finds all records where the “ContactTitle” field contains the three letters “man”.  Another version of this expression would substitute “Not” for “Like”. This would exclude all the records containing the same three letters and instead, return all the others.  The “In” operator checks against several choices. For example the expression: In (“Chicago”, “Bangor”, “Rome”) would return all records where the “City” field contained any one of those three names.

23 Parameter Queries  Lets take a look at a Select query that asks for all Products that have a UnitPrice between $2.25 and $4.75. Shown below is an example that will return that result. Suppose however that after running the query and getting the results, we decide that we wish to use different amounts.  We need to create another query. Or do we.

24 Parameter Queries (Contd.)  Shown below is a Parameter query which answers the dilemma shown in the previous slide. This query can be saved and run many times since it asks users at run time to enter the lower and upper ranges of UnitCost as Criteria.

25 Parameter Queries (Contd.)  Microsoft Access identifies this as a Parameter query because of the text entered between square brackets in the Criteria field. Because there are two sets of brackets, Access asks two questions using the text that you see. It then captures the users response and uses the values for Criteria. Parameter queries are very useful objects and very common.

26 Parameter Queries (Contd.)  On the right are the Message boxes presented to the user one at a time starting with the upper one. The user answers the first one by putting the lower range price into the text area of the box and clicks OK. The lower Message box is then displayed and the user responds with the upper range price and clicks OK. The query runs and returns the results.

27 What We Have Covered  Table Relationships.  Referential Integrity.  Datasheets.  What are Queries and what are they used for.  The various types of Queries.  Select Queries.  Parameter Queries.  Using Expressions in Queries.