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.

Slides:



Advertisements
Similar presentations
Microsoft Office 2007 Access Chapter 2 Querying a Database.
Advertisements

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.
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
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.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 1 1 Microsoft Access 2003 Tutorial 1 – Introduction To Microsoft Access 2003.
Chapter 2 Querying a Database
Chapter 3 Maintaining a Database
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,
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 1Advanced Tables, Relationships, Queries, and Forms Chapter 3Advanced Query Techniques.
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Introduction to Access By Mary Ann Chaney and Alicia Harkleroad.
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
Lesson 31: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Design.
Tutorial 8 Advanced Queries. Notes Switch to new database! Tutorial.08 folder Only Session 8.1 and 8.2.
Queries. What is a query? A query is actually the name for any database manipulation operation. The most commonly used type is a select query, which is.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 4 BACKNEXTEND 4-1 LINKS TO OBJECTIVES Query Design Query Criteria Modify a Query Using OR.
1 Chapter 7 Query-By-Example by Monica Chan CS157B Professor Lee.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 3 Analyzing Data and Creating Reports.
Analyzing Data For Effective Decision Making Chapter 3.
XP New Perspectives on Integrating Microsoft Office XP Tutorial 2 1 Integrating Microsoft Office XP Tutorial 2 – Integrating Word, Excel, and Access.
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.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 6 Switchboards, PivotTables, and PivotCharts.
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 2007 Access Chapter 2 Querying a Database.
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics to be covered §Comparing Values in Selection Criteria §Calculating Values in a Query §Changing the appearance.
FIRST COURSE Access Tutorial 4 Creating Forms and Reports.
® 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.
Database Systems Microsoft Access Practical #3 Queries Nos 215.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
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.
Tutorial 9 Using Action Queries and Advanced Table Relationships.
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.
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics Covered Understanding different types of Queries Creating a Query Creating a Query using a Wizard Changing.
Figure 2.1 The Open dialog box in the Startup window. Cancel button Open dialog box folders on drive C.
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.
Actions Queries. Understanding Action Queries  Action queries are a way to make corrections to database. They can make an enormous mess of database if.
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.
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.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Gold – Crystal Reports Introductory Course Cortex User Group Meeting New Orleans – 2011.
T7-1 LEARNING OUTCOMES – ACCESS PROBLEM SOLVING 1.Describe the process of using the Simple Query Wizard using Access 2.Describe the process of using the.
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.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 6 Action and Specialized Queries 1.
Key Applications Module Lesson 22 — Managing and Reporting Database Information Computer Literacy BASICS.
Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at
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.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 2 ® Building Queries.
Creating a multi-page form using Tab Controls. In today’s class, we will be using the Tab Control method to create the Form / SubForm combination.
Lesson 4: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Set query.
Access Module Implementing a Database with Microsoft Access A Great Module on Your CD.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Access Chapter 2 Querying a Database.
Objectives Query for top values Create a parameter query
Objectives Create an action query to create a table
Querying a Database Using the Select Query Window
Creating and Modifying Queries
Tutorial 9 Using Action Queries and Advanced Table Relationships
New Perspectives on Microsoft
Presentation transcript:

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 Multiple Tables Select Query, Select Query, SQL Query, SQL Query, Action Query Action Query Types of Action Query Types of Action Query

Abdus Salam3 Querying from Multiple Tables It is possible to base a query on more than one table, as long as there is always a suitable field by which the tables can be joined. The following example uses two tables, STUDENTS and COLLEGES, in a query.  Open the table called COLLEGES. Notice that this table has one record for each college. Apart from the college names, all other data items in the table are fictitious. The plus sign to the left of the CollegeName field indicates that this table is the ‘one’ side of a one-to-many relationship. Click the plus sign to see the related data.

Abdus Salam4 Querying from Multiple Tables (Cont’d) As with the STUDENTS table, queries could be created based on this single table. However, suppose we wished to extract all students studying maths and then communicate with their college principal.  The data about the college principal is in a different table from the student data.  The task could be achieved by a two-stage query: first find the maths students and then, knowing the college, look up the relevant principal. A much more efficient method is to use the relational capabilities of Access to run a query on more than one related table  The COLLEGES and STUDENTS tables have a one-to-many relationship between them. Each college has many students but a student is a member of only one college. Each college name will only appear once in the COLLEGES table (the ‘one’ side of the relationship), but may appear many times in the STUDENTS table (the ‘many’ side).

Abdus Salam5 Querying from Multiple Tables (Cont’d)  Click on the Queries button in the database window, double-click Create query in Design view to open a new query in Design view.  In the Show Table dialog box, add both tables to the query by highlighting each one in turn and then clicking the Add button.  Close the Show Table dialog box.  You should now see a query design window with the fields from the two tables available.

Abdus Salam6 Select Query  Various types of queries exist:  Select queries.  These are the queries that extract or show us data.  They will show data that complies with specific criteria.  Once we have the result we can consult the data and edit it (this can or cannot be done, depending on the query).  A select query generates a logical table (named this way because it is not actually in the hard drive but in the memory of the computer, and every time we open it is recalculated).  This is the most common type of query.

Abdus Salam7 SQL Query & Action Query  There is some statements that can not be defined from the Query Design View but rather directly in SQL, these are SQL-specific queries.  These queries will not be studies in this course as in order to define them knowledge of SQL is necessary, which is not part of the objective of this course  Action queries.  These are the queries that carry out changes to the records. Various types of action queries exist to delete, update, append data, and to create a new table from one existing table.  These queries are named delete queries, update queries, append queries and Make-Table queries.

Abdus Salam8 Types of Action Queries  Depending on what the query performs, there are four types of queries: Make-Table Queries Update Queries Append Queries Delete Queries  A Make-Table query creates a new table with the records stored in one or more tables.  They are usually used to create working tables  They can also be usefull to create export tables (extract data from a table to send it to someone or to make copies of our tables).  And finally they are used to create history tables.

Abdus Salam9 Make-Table Query  To create a Make-Table query:  Open a new query in design view.  We add one or more tables from where we are going to extract the data to save in our new table.  We design the query in the same way as a normal selection query, so that only the records we want to save in the new table will appear.  Then, we drop down the Query menu and select the Make-Table Query... option.  or,  we can drop down the list from the button on the toolbar and select the Make-Table Query... option.

Abdus Salam10 Make-Table Query (Cont’d)  The Make table dialogue appears:  We type the name of the new table in Table Name: box.  We normally create the table in the same database (Current database option) but we can create it in another database, and in this case we will need to check the Another database: option and type the name of the database where the table should be made in the File Name: box. It needs to be the complete name including the complete path, and therefore it is easier looking for the database using the Browse... button; click on it and search for the database where we want to save the new table.  Finally, click on the OK button and we return to the Query design:

Abdus Salam11 Make-Table query (Cont’d)  The design window is the same as that of a selection query, and in it we define the selection query in order to obtain the data to be saved in the new table.  The only difference is that on the title bar, after query name, we can see the words Make Table Query and if we open the query properties by clicking on the button on the toolbar we will see the name of the table to create in the Destination table property and the database where it will be made in the Destination DB.

Abdus Salam12 Update Query  Update queries allow us to modify the data stored in a table.  In only one operation, all the records can be changed at the same time, or only those with a determined condition.  To create an Update query:  We open a new query in design view.  We add the table that we would like to update.  We drop down the Query menu and select the Update query option.

Abdus Salam13 Update Query (Cont’d)  As from this moment the QBE grid changes its appearance, the Sort: and Show: rows have disappeared for lack of significance here and have been replaced by the Update to: row as we can see in the next example.  1 Open the Classes.mdb database.  2 Position yourself in the Queries tab of the Database window.  3 Click on the Create query in Design view option.  4 Click on the Courses table.  5 Click on the Add button.  6 Click on the Close button to close the dialogue box.  We will now add the fields that we need (those that we to update and those that we need to add in the search criteria, in our exercise we want to update all the courses and so we will not put a search criteria), we will only add Hours.

Abdus Salam14 Update Query (Cont’d)  Double click on the Hours field.  Drop down the button on the toolbar and select the Update query option.  In the Update to: row Type [Hours]*1.1 or if you prefer [Hours] + ([Hours]*10/100).  Click on the button to update.  Close the query, name it Increase by 10 percent.

Abdus Salam15 Append Queries  Append queries are those queries that add whole rows to a table.  The new records are added at the end of the table.  We can insert one row or various rows at the same time, normally getting the data from another table, and so an append query has a source (the table or tables where it gets the data from) and a destiny (the table where we will insert the data).  The mechanism is similar to that of a make-table query in so far as we define a selection query which permits us to obtain the data to save, and what does vary is that now we have to indicate into which column we want to save every value.  To create an Append query:  We open a new query in design view.  We add the table or tables that we want to extract the data from to store in the destination.  We design the query as we would a normal selection query, in such a way that the data to insert will appear in the result of this query.  We drop down the Query menu and select the Append query... option.

Abdus Salam16 Delete Queries  Delete queries are queries that remove records from a table.  To create a delete query:  Open a new query in design view.  Add the table from which we want to delete records.  Drop down the Query menu and select the Delete query option

Abdus Salam17 Crosstab Query Wizard  Crosstab Query Wizard— This wizard displays summarized values, such as sums, counts, and averages, from a field. One field is used on the left side of the Query datasheet to cross- reference other field columns in the Query datasheet.  E.g. Employees_crosstab Query  Find Duplicates Query Wizard— This query is used to compare two tables and find duplicate records.  E.g. Find duplicates for Employees query  Find Unmatched Query Wizard— This wizard compares two tables and finds all records that don't appear in both tables (based on comparing certain fields).  E.g. Department Without Matching Student Info query