CSC 240 (Blum)1 Introduction to Data Entry, Queries and Reports.

Slides:



Advertisements
Similar presentations
Access Manual 4 By Elham S.Khorasani Ismail Guneydas Dhawala Kovuri.
Advertisements

Benchmark Series Microsoft Access 2010 Level 1
MS-Access XP Lesson 2. Input Mask Property 1.Field : Phone No Data Type : Number Input Mask : Character 0 represent a single digit and phone.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT ACCESS Lesson 4 – Finding and Ordering Data.
Concepts of Database Management Seventh Edition
Access Lesson 2 Creating a Database
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 3 1 Microsoft Office Access 2003 Tutorial 3 – Querying a Database.
XP Chapter 3 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Analyzing Data For Effective Decision Making.
Creating Custom Forms. 2 Design and create a custom form You can create a custom form by modifying an existing form or creating a new form. Either way,
Querying a Database Using the Select Query Window
Querying a Database Microsoft Office Access 2003.
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.
Microsoft Office Word 2013 Expert Microsoft Office Word 2013 Expert Courseware # 3251 Lesson 4: Working with Forms.
1 Access Lesson 3 Creating Queries Microsoft Office 2010 Introductory Pasewark & Pasewark.
1 Access Lesson 3 Creating Queries Microsoft Office 2010 Introductory.
1 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and Custom Forms.
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.
With Microsoft Office 2007 Introductory© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Introductory.
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
PHP meets MySQL.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
Analyzing Data For Effective Decision Making Chapter 3.
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.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
Concepts of Database Management Seventh Edition
Database Systems Microsoft Access Practical #1 Creating Tables Nos 215.
Database Systems Microsoft Access Practical #2 Making Forms and Reports Nos 215.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
Database Systems Microsoft Access Practical #3 Queries Nos 215.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
CSC 240 (Blum)1 Forms and Importing Data in Access.
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.
1 Database Systems Introduction to Microsoft Access Part 2.
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 3 BACKNEXTEND 3-1 LINKS TO OBJECTIVES Modify a Table – Add, Delete, Move Fields Modify a Table.
McGraw-Hill/Irwin ©2005 The McGraw-Hill Companies, All rights reserved ©2005 The McGraw-Hill Companies, All rights reserved McGraw-Hill/Irwin.
1 CSE 2337 Introduction to Data Management Access Book – Ch 1.
Pasewark & Pasewark 1 Access Lesson 3 Creating Queries Microsoft Office 2007: Introductory.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/Programs/Microsoft Office/Microsoft Office.
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.
DataSet Your Database student test score Database Connection Your program needs to establish a connection to the database. Click on “Add New Data Source.”
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.
1 11 Exploring Microsoft Office Access 2007 Chapter 6 Data Protection.
Query Lab CSC 240 Blum1. Log on to PMA (PHPMyAdmin) and click on the Northwind database CSC 240 Blum2.
Key Applications Module Lesson 22 — Managing and Reporting Database Information Computer Literacy BASICS.
Exploring Microsoft Access Chapter 5 One-to-Many Relationships: Subforms and Multiple Table Queries.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 5 1 Microsoft Office Access 2003 Tutorial 5 – Enhancing a Table’s Design.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 6 1 Microsoft Office Access 2003 Tutorial 6 – Creating Custom Forms.
Access Module Implementing a Database with Microsoft Access A Great Module on Your CD.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall. 1 Skills for Success with Microsoft ® Office 2007 PowerPoint Lecture to Accompany.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
Objectives Query for top values Create a parameter query
Microsoft Office Access 2003
Introduction to Access 2003
Tutorial 3 – Querying a Database
Microsoft Office Access 2003
Microsoft Office Access 2003
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

CSC 240 (Blum)1 Introduction to Data Entry, Queries and Reports

CSC 240 (Blum)2 Recall that our database had four tables: Customer, Item, Order and ItemInOrder

CSC 240 (Blum)3 Lookup Wizard Recall that we used the Lookup Wizard to establish relationships between tables, for example the Order table has a field corresponding to the CustomerID. When entering an order, a person will be presented with a drop-down list of customers. There is an implication here that the customer data precedes the order data. Similarly the order data and item data precede the item-in-order data. The logic/structure of our database design implies a logic/order to data entry.

CSC 240 (Blum)4 Data Entry Dependence CustomerItem Order ItemInOrder Customer must precede Order. Order and Item must precede ItemInOrder.

CSC 240 (Blum)5 Double click on the Customer table to open it up in DataSheet view.

CSC 240 (Blum)6 Enter some customer data

CSC 240 (Blum)7 What one can do in DataSheet view In DataSheet view, one can look at the data, add new data, remove any of the data and change any of the existing fields. With more sophisticated database, one will separate out these possibilities and assign different users different permissions. One will specify whether a user can SELECT, INSERT, DELETE and UPDATE particular data.

CSC 240 (Blum)8 Open the Item table in DataSheet view and enter some data.

CSC 240 (Blum)9 Open up the Order table

CSC 240 (Blum)10 It’s not all or nothing In order to start associating items with an order in the ItemInOrder table we must first have the corresponding Order record. But that does not mean we must know the final value for every field in the Order record. –Clearly we will not immediately know the OrderDateShipped.

CSC 240 (Blum)11 Go to the View drop-down selector and choose Design View

CSC 240 (Blum)12 Make sure the OrderDateShipped is not required.

CSC 240 (Blum)13 Back in DataSheet view when one clicks in the CustomerID field a drop-down arrow appears on the right. Use it to lookup the Customer. Recall we designed it to show customer names even though we are really looking up customer IDs.

CSC 240 (Blum)14 Strictly speaking it is looking up CustomerID, but the user is expected to supply customer names. If one types something that is not a valid customer last name and hit Enter, an error message results. Referential Integrity!

CSC 240 (Blum)15 Even if one enters a valid customer ID, it does not accept it – since we told Access the user would be using customer names here, that is what it expects. (If one types a valid last name, it accepts it.)

CSC 240 (Blum)16 Enter some Order records.

CSC 240 (Blum)17 Open the ItemInOrder table in DataSheet view and enter some data.

CSC 240 (Blum)18 If one tries to enter a duplicate item within the same order, an error message arises because the combination of Order and Item serves as a primary key and thus must be unique for each record. (Occurs when you try to move to another record.)

CSC 240 (Blum)19 No escape After entering an invalid record –If there are other records to enter, there is no problem. –If there are not, one will have started a record that is invalid and trying to leave it will produce error messages and give the data entry person a sense that the cannot escape from this problem. –Closing the table will produce some error messages but will produce the desired result – all of the previously entered valid records will be saved and the invalid record will not.

Saving occurs more often than in other Office applications and without the user explicitly selecting Save. CSC 240 (Blum)20

CSC 240 (Blum)21 Click on the Create tab and then on Query Design.

CSC 240 (Blum)22 Introduction to Querying The approach we will be taking here is known as Query-by-Example. The language for querying is SQL, so we could also write a SQL statement. The first step is to settle on a question to ask. –Let us start with something simple such as what are our customer’s names. The next step is to add the tables necessary to answer the question. –This query involves only the customer table.

CSC 240 (Blum)23 Select the Customer table and click Add to make it part of the query. (Close if this is the only table you want.)

CSC 240 (Blum)24 Next drag the fields involved in the query into the grid below.

CSC 240 (Blum)25 Click on the drop-down list in the View button and select DataSheet View.

CSC 240 (Blum)26 DataSheet View shows the results of the query. This query might be called a projection – it “projects” out the fields we want to see.

CSC 240 (Blum)27 Click on the drop-down list in the View button and select SQL View.

CSC 240 (Blum)28 SQL View shows a SQL statement that would yield the results of the Query-by-Example.

CSC 240 (Blum)29 One can use the drop-down box in the Sort field under the CustomerLastName to choose Ascending to place the names in alphabetical order by last name.

CSC 240 (Blum)30 DataSheet View of Alphabetized results

CSC 240 (Blum)31 SQL View of Alphabetized results

CSC 240 (Blum)32 When one closes the query, one is prompted to save it, give it a name.

Use the drop-down on the left-hand side to select Queries to obtain list of queries. CSC 240 (Blum)33

CSC 240 (Blum)34 Next design a query that shows only customers from PA. Add the CustomerState field to the query and add a condition to the corresponding Criteria field. Such a query can be called a “selection” – as it selects out records that satisfy some condition.

CSC 240 (Blum)35 Results of PA Selection

CSC 240 (Blum)36 Uncheck the show checkbox under state so that it is involved in the query but not displayed in the results.

CSC 240 (Blum)37 Results of PA Selection without state showing.

CSC 240 (Blum)38 SQL View of state selection query. Access generates more parentheses than necessary.

CSC 240 (Blum)39 Change the criteria field to a phrase in square brackets to allow the user of the query to enter a state during the query’s execution.

CSC 240 (Blum)40 Executing the query now gives rise to an input box for the user to enter a state. Such a query is said to be “parametrized” or “parameterized.”

CSC 240 (Blum)41 Results of parameterized state query.

CSC 240 (Blum)42 SQL View of Parameterized state query.

CSC 240 (Blum)43 Save the parameterized query

CSC 240 (Blum)44 The Join Next create a query that lists the orders and the names and phone numbers of those who have placed those orders. This query requires information from two tables: Customer and Order. The tables are said to be “joined.” –More on what that actually means another time, let us just see the results on it here.

CSC 240 (Blum)45 Add Customer and Order to the query, then add the desired fields to the grid, choose to sort by Ascending on the OrderID. If that line connecting the tables is not there, make it by dragging the CustomerID field in one table over to the CustomerID field in the other table.

CSC 240 (Blum)46 Customer-Order join results in DataSheet View

CSC 240 (Blum)47 SQL View of Customer-Order join

CSC 240 (Blum)48 Save the Customer-Order query

CSC 240 (Blum)49 Building a Customer-Items query Next we want a list of the customers, their phone numbers and the items they have ordered. This involves all four tables – since the relationship of customer is to order, and the relationship of order to item is realized through the ItemInOrder table.

CSC 240 (Blum)50 Add the tables, drag the desired fields to the grid, etc.

CSC 240 (Blum)51 Customer-Item query in DataSheet View

CSC 240 (Blum)52 Customer-Item query in SQL View

CSC 240 (Blum)53 Save CustomerItems query.

CSC 240 (Blum)54 Suppose we had to recall an item. We would want a list of customers who had bought a particular item. One decision in such a query is whether we select on the item’s name or item’s ID. –Let us choose here to go with ID. One might want to make accompanying queries that will either provide the user with a list of item names and Ids or a parameterized query allowing the user to supply the name and obtain the corresponding ID. Recall query

CSC 240 (Blum)55 Design of parameterized recall query.

CSC 240 (Blum)56 DataSheet View of parameterized recall query. Recall that we told Access to show us the Item name instead of the itemID in the ItemInOrder table.

CSC 240 (Blum)57 SQL View of parameterized recall query.

CSC 240 (Blum)58 Save the parameterized query.