1 All Powder Board and Ski Microsoft Access Workbook Chapter 4: Queries Jerry Post Copyright © 2003.

Slides:



Advertisements
Similar presentations
All Powder Board and Ski
Advertisements

1 All Powder Board and Ski Microsoft Access Workbook Chapter 9: Data Warehouses and Data Mining Jerry Post Copyright © 2007.
1 All Powder Board and Ski Microsoft Access Workbook Chapter 5: Advanced Queries Jerry Post Copyright © 2007.
1 All Powder Board and Ski Microsoft Access Workbook Chapter 6: Forms and Reports Jerry Post Copyright © 2007.
Chapter 10 Excel: Data Handling or What do we do with all that data?
DAY 10: MICROSOFT EXCEL – CHAPTER 8 MICROSOFT EXCEL – CHAPTER 9 MICROSOFT EXCEL – CHAPTER 10 Akhila Kondai September 23, 2013.
Microsoft Excel Presented by ShoWorks Fair Software and Online Entries
Introduction to Microsoft Excel 2010 Chapter Extension 3.
1 All Powder Board and Ski SQL Server Workbook Chapter 4: Queries Jerry Post Copyright © 2003.
1 Copyright © 2010 Jerry Post with additions & narration by M. E. Kabay. All rights reserved. Advanced Queries IS240 – DBMS Lecture # 8 – M.
Chapter 5 Creating, Sorting, and Querying a Table
Exploring Microsoft Excel 2002 Chapter 7 Chapter 7 List and Data Management: Converting Data to Information By Robert T. Grauer Maryann Barber Exploring.
Microsoft Excel Working with Excel Lists, Subtotals and Pivot Tables.
5 Chapter 5 Structured Query Language (SQL2) Revision.
Mgt 240 Lecture MS Excel and Access: Introduction to Databases September 23, 2004.
Concepts of Database Management Sixth Edition
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Chapter 06: Lecture Notes (CSIT 104) 1 Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Copyright © 2008 Prentice-Hall. All rights reserved.
Microsoft Office Excel 2013 Expert Microsoft Office Excel 2013 Expert Courseware # 3254 Lesson 5: Pivot Charts and Advanced Formulas.
Introduction to Microsoft Access Danielle Zammit B.Pharm. (Hons.), M.S.(Pharm.)
1 All Powder Board and Ski Microsoft Access Workbook Chapter 4: Queries Jerry Post Copyright © 2007.
Chapter 5 Advanced Querying
XP Agenda Video Last Class Excel Tutorial 5: Working with Excel Lists Agenda for Next Class 1 New Perspectives on Microsoft Office Excel 2003 Tutorial.
All Powder Board and Ski SQL Server 2000 Workbook Chapter 1 Jerry Post Copyright © 2003.
Microsoft Access 2010 Building and Using Queries.
1 All Powder Board and Ski Oracle 9i Workbook Chapter 7: Integrity and Transactions Jerry Post Copyright © 2003.
1 All Powder Board and Ski SQL Server Workbook Chapter 2: Database Design Jerry Post Copyright © 2004.
Excel Project 2 Formulas, Functions, and Formatting.
1 All Powder Board and Ski Microsoft Access Workbook Chapter 10: Distributed Databases Jerry Post Copyright © 2003.
1 All Powder Board and Ski Oracle 9i Workbook Chapter 9: Database Administration Jerry Post Copyright © 2003.
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
Chapter 17 Creating a Database.
Copyright © 2008 Pearson Prentice Hall. All rights reserved Chapter 6 Data Tables and Amortization Tables Exploring Microsoft Office Excel 2007.
1 All Powder Board and Ski Oracle 9i Workbook Chapter 4: Queries Jerry Post Copyright © 2003.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. a lesson approach Microsoft® Excel 2010 © 2011 The McGraw-Hill Companies,
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
XP. Objectives Sort data and filter data Summarize an Excel table Insert subtotals into a range of data Outline buttons to show or hide details Create.
1 All Powder Board and Ski Microsoft Access Workbook Chapter 6: Forms, Reports, and Applications Jerry Post Copyright © 2003.
1 All Powder Board and Ski Oracle 9i Workbook Chapter 8: Data Warehouses and Data Mining Jerry Post Copyright © 2003.
All Powder Board and Ski Microsoft Access Workbook Chapter 2: Database Design Jerry Post Copyright © 2003.
1 Copyright © 2010 Jerry Post & M. E. Kabay. All rights reserved. Queries: Part 2 of 2 IS240 – DBMS Lecture # 7 – M. E. Kabay, PhD, CISSP-ISSMP.
1 All Powder Board and Ski Microsoft Access Workbook Chapter 8: Data Warehouses and Data Mining Jerry Post Copyright © 2003.
Concepts of Database Management Seventh Edition Chapter 3 The Relational Model 2: SQL.
With Microsoft Excel 2007Comprehensive 1e© 2008 Pearson Prentice Hall1 Chapter 4: PowerPoint Presentation GO! with Microsoft Excel ® 2007 Comprehensive.
1 All Powder Board and Ski Microsoft Access Workbook Chapter 5: Advanced Queries Jerry Post Copyright © 2003.
Microsoft® Excel Create an Excel table. 1 Work with the Table Tools Design tab. 2 Sort and filter records in a table. 3 Identify structured references.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 6 BACKNEXTEND 6-1 LINKS TO OBJECTIVES Using the Report Button Using the Report Button Print.
Microsoft Office 2013 Try It! Chapter 4 Storing Data in Access.
1 Chapter 3 Single Table Queries. 2 Simple Queries Query - a question represented in a way that the DBMS can understand Basic format SELECT-FROM Optional.
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
1 All Powder Board and Ski SQL Server Workbook Chapter 5: Advanced Queries Jerry Post Copyright © 2003.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
McGraw-Hill/Irwin Copyright © 2005 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 9: Database Administration All Powder Board and Ski.
Chapter 1: Introduction All Powder Board and Ski
Chapter 6: Forms, Reports and Applications All Powder Board and Ski
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
M. E. Kabay, PhD, CISSP-ISSMP V:
Microsoft Office Illustrated Introductory, Windows Vista Edition
Chapter 2: Database Design All Powder Board and Ski
Objectives Create an action query to create a table
All Powder Board and Ski
All Powder Board and Ski
Building and Using Queries
Action Query Exercises
Microsoft Office Illustrated Introductory, Windows XP Edition
Tutorial 9 Using Action Queries and Advanced Table Relationships
Presentation transcript:

1 All Powder Board and Ski Microsoft Access Workbook Chapter 4: Queries Jerry Post Copyright © 2003

2 Primary Tables

3 File/Get External Data/Import The sample files include column names Comma delimited is common Make sure columns are correct

4 Starting a Query Select tables Show table list Display fields/columns Conditions Switch to SQL or view results

5 Sample Query Display snowboards with a list price under $300 and max weight over 150 pounds. SELECT ItemModel.Category, ItemModel.ListPrice, ItemModel.WeightMax, ItemModel.Color, ItemModel.Graphics FROM ItemModel WHERE (((ItemModel.Category)="Board") AND ((ItemModel.ListPrice) 150));

6 More Complex Query Ski for jumping. Composite material. Red or Yellow main color. Yellow skis must be under $300. Red skis must be under $400 Three main conditions

7 Color Options Yellow and price conditions All 5 conditions must hold, so only one row matches

8 Multiple Conditions Add a new Criteria row for red skis

9 SQL Versions SELECT ItemModel.Category, ItemModel.Color, ItemModel.ItemMaterial, ItemModel.Style, ItemModel.ListPrice FROM ItemModel WHERE (((ItemModel.Category)="Ski") AND ((ItemModel.Color)="Yellow") AND ((ItemModel.ItemMaterial)="Composite") AND ((ItemModel.Style)="Jump") AND ((ItemModel.ListPrice)<300)) OR (((ItemModel.Category)="Ski") AND ((ItemModel.Color)="Red") AND ((ItemModel.ItemMaterial)="Composite") AND ((ItemModel.Style)="Jump") AND ((ItemModel.ListPrice)<400)); SELECT Category, Color, ItemMaterial, Style, ListPrice FROM ItemModel WHERE (Category="Ski" AND ItemMaterial="Composite" AND Style="Jump") AND ( ( Color="Yellow" AND ListPrice<300) OR (Color="Red" AND ListPrice<400) );

10 JOIN Query: Sales Sales in MayCash payment

11 JOIN Tables: Sale + Customer Matching names

12 JOIN: SQL SELECT Sale.SaleID, Sale.SaleDate, Sale.CustomerID, Customer.LastName, Customer.FirstName, Sale.PaymentMethod FROM Customer INNER JOIN Sale ON Customer.CustomerID = Sale.CustomerID WHERE (Sale.SaleDate Between #5/1/2004# And #5/31/2004# AND Sale.PaymentMethod="Cash");

13 Building a more complex query Which customers bought Atomic skis in January or February? What do you want to see?Customer names, SaleDate What do you know?Manufacturer name, SaleDate range, Category is Ski What tables are involved? How are they joined? Customer … Sale … ItemModel, Manufacturer SELECTLastName, FirstName, SaleDate FROM Customer, …, Sale, …, ItemModel, Manufacturer JOIN WHERE Manufacturer.Name=“Atomic” AND Sale.SaleDate BETWEEN 1/1/2004 AND 2/29/2004 AND ItemModel.Category = “Ski”

14 Join: Many Tables

15 SQL: Many Table Joins SELECT Customer.LastName, Customer.FirstName, ItemModel.Category, Manufacturer.Name, Sale.SaleDate FROM Manufacturer INNER JOIN (ItemModel INNER JOIN (Inventory INNER JOIN ((Customer INNER JOIN Sale ON Customer.CustomerID = Sale.CustomerID) INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID) ON Inventory.SKU = SaleItem.SKU) ON ItemModel.ModelID = Inventory.ModelID) ON Manufacturer.ManufacturerID = ItemModel.ManufacturerID WHERE (((ItemModel.Category)="Ski") AND ((Manufacturer.Name)="Atomic") AND ((Sale.SaleDate) Between #1/1/2004# And #2/29/2004#));

16 Calculations Calculated column SELECT Category, ItemMaterial, ListPrice, ListPrice-Cost AS Profit FROM ItemModel ORDER BY Category, ListPrice DESC;

17 Common Functions LcaseTo lower case LenLength/number of characters MidGet substring TrimRemove leading and trailing spaces UcaseTo upper case DateCurrent date DateAddAdd days, months, years to a date DateDiffSubtract two dates FormatHighly detailed formatting NowCurrent date and time AbsAbsolute value CosCosine, all common trig functions IntInteger, drop decimal values SgnSignum RoundRound-off

18 Format Function

19 DateAdd and DateDiff SaleDate + one monthSaleDate + 30 days

20 Query: Sum Totals button adds the Total row Calculation functions SumOfSalesTax $5,332.11

21 SQL: Sum SELECT Sum(Sale.SalesTax) AS SumOfSalesTax FROM Sale WHERE Sale.ShipState="CA"

22 Query: Group By Group By produces subtotals for all values in the specified column

23 SQL: Group By SELECT Sale.ShipState, Sum(Sale.SalesTax) AS SumOfSalesTax FROM Sale GROUP BY Sale.ShipState;

24 Total Sales Value in Colorado SaleTotal $4, SELECT Sum([QuantitySold]*[SalePrice]) AS SaleTotal FROM Sale INNER JOIN SaleItem ON Sale.SaleID = SaleItem.SaleID WHERE Sale.ShipState="CO";