Calculations in Queries

Slides:



Advertisements
Similar presentations
 Microsoft Excel is an electronic spreadsheet.  As with a paper spreadsheet, you can use Excel to organize your data into rows and columns and to perform.
Advertisements

Spreadsheets A spreadsheet package is a general purpose computer package that is designed to perform calculations. A spreadsheet is a table which is divided.
General Astronomy Using Excel for Lab Analysis. Introduction Being able to use a spreadsheet to help in analysis of any laboratory work is a very useful.
Loading Excel Double click the Excel icon on the desktop (if you have this) OR Click on Start All Programs Microsoft Office Microsoft Office Excel 2003.
With Microsoft Access 2010 © 2011 Pearson Education, Inc. Publishing as Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access.
Creating and Editing Reports. Starter – Guess the Words… Reports R e p o r t Label.
Concepts of Database Management Seventh Edition
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Query-By-Example (QBE) 2440: 180 Database Concepts.
® Microsoft Access 2010 Tutorial 6 Using Form Tools and Creating Custom Forms.
Database Applications – Microsoft Access Lesson 9 Designing Special Queries Updated 4/11.
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.
WORKING WITH STRUCTURED DATA (1/3) Functional ICT.
Microsoft Access Get a green book. Page AC 2 Define Access Define database.
Spreadsheets in Finance and Forecasting Presentation 9 Macros.
 Continue queries ◦ You completed two tutorials with step-by-step instructions for creating queries in MS Access. ◦ Now must apply knowledge and skills.
Database Queries. Queries Queries are questions used to retrieve information from a database. Contain criteria to specify the records and fields to be.
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.
Concepts of Database Management Seventh Edition
Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! With Microsoft ® Office 2007 Intermediate Chapter.
COMPREHENSIVE Access Tutorial 6 Using Form Tools and Creating Custom Forms.
Key Words: Functional Skills. Key Words: Spreadsheets.
Database Applications – Microsoft Access Lesson 4 Working with Queries 36 Slides in Presentation.
1 Chapter 3: Customize, Analyze, and Summarize Query Data Exploring Microsoft Office Access 2007.
1. 2 Word Processing Word Processing is writing words and sentences on the computer. It is easy to change or move text in a word document. People use.
A spreadsheet is a programme which stores data in a grid. Many people use spread sheets as an online calculator instead of working lots of calculations.
Introduction to Spreadsheets Part 1 The ‘Quick’ and ‘Easy’ guide to using Microsoft Excel.
G042 - Lecture 12 Using Local Databases Mr C Johnston ICT Teacher
Databases – Part 2 Databases– Part 2 Lesson 5 & 6.
PeopleSoft Financials Advanced Query Training Financial Information Systems and Reporting Controller’s Division
Paper 2 Exam Tips Guidance: 1.Evidence Document 2.Unit 9: – Communication ( ) 3.Unit 10: - Document Production (Word) 4.Unit 16: PowerPoint 5.Unit.
Relational Databases Today we will look at: Different ways of searching a database Creating queries Aggregate Queries More complex queries involving different.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 11 Chapter 3: Customize, Analyze, and Summarize Query Data Exploring Microsoft Office.
ECDL ECDL is an important building block, equipping you with the digital skills needed to progress to further education and employment. ECDL teaches you.
The Basics of Formulas & Functions
GO! with Microsoft Office 2016
Microsoft Access – Tutorial 3
Queries.
DATABASE CONCEPTS A database is a collection of logically related data designed to meet the information needs of one or more users Data bases are store-houses.
Lesson 2 Tables and Charts
Statistical Analysis with Excel
GO! with Microsoft Access 2016
REACH Computer Resource Center
Computer Fundamentals
MS-Excel Part 1.
Excel Formulas & Functions.
Statistical Analysis with Excel
GO! with Microsoft® Access e
Database Queries.
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Statistical Analysis with Excel
Exploring Microsoft Office Access 2007
Exploring Microsoft® Office 2016 Series Editor Mary Anne Poatsy
Access: Queries IV Participation Project
Access: Queries II Participation Project
Operators and Wildcards
Nagendra Vemulapalli Access chapters 3&6 Nagendra Vemulapalli
REACH Computer Resource Center
Mr Watson’s Introduction to Spreadsheets
Creating Reports.
Using Complex Formulas, Functions, and Tables
By the end of the lesson, I want you to be able to say…
Unit J: Creating a Database
New Perspectives on Microsoft
Microsoft Office Illustrated Fundamentals
TERMS AND CONDITIONS   These PowerPoint slides are a tool for lecturers, and as such: YOU MAY add content to the slides, delete content from the slides,
Presentation transcript:

Calculations in Queries

Learning intentions We are learning: How to perform a calculation using an Aggregate Function How to perform a calculation by creating a Calculated Field

Success criteria You will successfully be able to perform Aggregate Functions - SUM, AVERAGE, MAX and MIN functions You will know how to create a new field within a query, and use existing fields to perform a variety of calculations

When you create a query you can perform calculations in 2 different ways: use Aggregate functions Create a calculated field

In your Higher exam it is most likely that you will be asked to carry out one or both of these in the database task.

Aggregate functions You could be asked to use the Aggregate Function which can be recognised if you look for this icon:

This is positioned at top right of the screen

AGGREGATE FUNCTIONS When you click on this icon, this will add an extra row to your query.

Aggregate functions This enables you to select the most appropriate function for the scenario you are working with. The terminology here is reminiscent of when we were working on Spreadsheets! If you are looking for: Aggregate Function selected Total SUM Number of … COUNT Biggest number MAX Smallest number MIN Average AVERAGE

Worked examples – TAYFORTH CARAVANS

Remember to look carefully at the database tables before you start! Aggregate functions We are going to have a look at the Caravan Database to see if we can: Calculate the number of caravans held in stock from each Manufacturer Calculate the total value of caravans held in stock from each Manufacturer Remember to look carefully at the database tables before you start!

AGGREGATE FUNCTIONS

AGGREGATE FUNCTIONS Steps What you need to do: 1 Look carefully at the table information, and look carefully at what is being asked you in the task. 2 Add the relevant fields to the Query. 3 Click on the 4 See how there is an additional line added to your query which enables you to Group By: 5 Choose the correct function from SUM, AVERAGE, COUNT, MAX or MIN. 6 Run the Query in the usual way to check that this works

AGGREGATE FUNCTIONS UNACCEPTABLE HEADING UNACCEPTABLE HEADING Results will look something like this! MANUFACTURER CountOfMANUFACTURER SumOfPRICE Ariada 7 £85,957.00 Barclay 10 £123,153.00 Church 11 £178,498.00 Kirkwood £73,177.00 Meridian £68,570.00 Stellar £137,954.00 These headings can be renamed in the Properties. Keep all headings consistent!

AGGREGATE FUNCTIONS You need to go back to design view of the Query and right click under the MANUFACTURER Field Heading. This will bring up the Properties box. Click on this!

The Property Sheet appears at the right hand side, and you will see a blank Caption Box. THIS IS WHERE YOU SHOULD ADD YOUR HEADING. Run the query to check that it works!

We now need to repeat the process for this field to add in a name that makes sense.

This is what you would would print, preferably as a report This is what you would would print, preferably as a report. (You could also be asked to paste into a Word Document or a Powerpoint, depending on the task).

Creating a calculated field This is where you use information in existing fields to create and perform a calculation in a new field. This could be: An increase in price using a percentage A decrease in price using a percentage Addition or subtraction Multiplication or division

Mathematical operators for calculated fields + - * /

CALCULATED FIELDS

Calculated fields You are going to work out a 10% discount on all 2007 Caravans in stock. You should print this query showing Manufacturer, Model, Price, Discount Amount and Reduced Price.

Worked examples – TAYFORTH CARAVANS

Calculated queries Its now time to add in 2 Calculated Fields: Discount Amount Reduced Price

Price and Discount Amount Fields not properly formatted – all prices should be consistently formatted! Run the query …

Calculated fields You need to go back to design view of the Query and right click under the PRICE Field Heading. This will bring up the Properties box. Click on this!

Calculated fields Format this Field appropriately, and ensure all others are formatted appropriately

A NOTE ON THE Use of square brackets These are used to tell the computer that you are doing a calculation working with an existing field. You must remember to add [ at the start and ] at the end of the field name. For example: DISCOUNT AMOUNT:[PRICE]*0.1 REDUCED PRICE:[PRICE]-[DISCOUNT AMOUNT] The Labels are here in pink – if you miss these out in the query the computer will put in a heading Expr1. You can fix this by including the label - you can also change this in the Caption if you prefer. Either way, all headings must be meaningful.

CALCULATED FIELDS Steps What you need to do: 1 Look carefully at the table information, and look carefully at what is being asked of you in the task. 2 Add the relevant fields to the Query. 3 Add in a New Field on the right hand side of the query. 4 Add a label for your field, followed by a colon! 5 Use existing fields to make the calculation – all existing fields must be displayed within square brackets. You can only make a calculated field from existing fields. 6 Ensure your calculation is correct using your Numeracy Skills. Run the Query in the usual way to check that this works and Caption the heading if necessary.

Printing results of queries Results of queries can be printed by copy and pasting the results to a Word document Its better if you print them in a database report, demonstrating your knowledge of reports. You may have to include your query results in a business letter or in a Powerpoint presentation, so in this case your would simply open the document and paste the query results in the relevant place.