Lecture Access – Queries. What’s a Query? A question you ask a database –ie: “Who are my Stockton customers?” –ie: “How much did Bob sell on the 14th?”

Slides:



Advertisements
Similar presentations
Tutorial 3 Queries and Table Relationships
Advertisements

Concepts of Database Management Seventh Edition
Database Features. Lists n An Excel worksheet can be used like a table in a relational database. n In Excel, such a table is called a list. n Each row.
Access Tutorial 3 Maintaining and 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.
Querying a Database Using the Select Query Window
Lecture Access – Tables. What are Tables? Records Fields.
Concepts of Database Management Sixth Edition
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.
Interpreting SQL Code. SQL (The language used to query a database) S is used to specify the you want to include. F is used to specify the the selected.
Access 2007 ® Use Databases How can Access help you to find and use information?
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Maintaining and Querying a Database Microsoft Access 2010.
DAY 16: ACCESS CHAPTER 2 Tazin Afrin October 10,
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,
Lesson 31: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Design.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
CS&E 1111 AcQueries Querying in Access Sorting data Aggregating Data Performing Calculations Objectives: Learn how to use the Access Query Design Tool.
Microsoft Access Intro Class 5 Working with Queries.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 4 BACKNEXTEND 4-1 LINKS TO OBJECTIVES Query Design Query Criteria Modify a Query Using OR.
HAP 709 – Healthcare Databases SQL Data Manipulation Language (DML) Updated Fall, 2009.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 3 Analyzing Data and Creating Reports.
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 Building and Using Queries.
Analyzing Data For Effective Decision Making Chapter 3.
Lecture Access – Reports. What’s a Report? Way to analyze your data –Groups –Sum / Average Paper or HTML output (or screen preview) Based on live data.
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.
Inner Join vs. Outer Join
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
Using Special Operators (LIKE and IN)
Concepts of Database Management Seventh Edition
Part II. Query Types On the design query table pane, right click and the cascading window will appear.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T7 PROBLEM SOLVING USING ACCESS.
1 Database Systems Introduction to Microsoft Access Part 2.
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.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
Microsoft Office 2003: Advanced 1 ADVANCED MICROSOFT ACCESS Lesson 10 – Analyzing Data.
What are queries? Queries are a way of searching for and compiling data from one or more tables. Running a query is like asking a detailed question of.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
CHAPTER 1 – INTRODUCTION TO ACCESS Aliya Farheen March 5, 2014.
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.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Aliya Farheen October 29,2015.
(SQL - Structured Query Language)
DAY 18: MICROSOFT ACCESS – CHAPTER 3 CONTD. Akhila Kondai October 21, 2013.
Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at
Filters, Queries and Reports. Filters Limit the data, creating a dataset, or partial view of the whole database Single use – filters do not save with.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 2 ® Building Queries.
QUERY CONSTRUCTION CS1100: Data, Databases, and Queries CS1100Microsoft Access1.
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.
Fall Lab 131 CS105 Lab 13 – Logical Operator Precedence and Joining Tables Announcements: MP 3 released Friday, 11/20 Honors project due: Tuesday,
MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Sravanthi Lakkimsety Mar 14,2016.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
1 Database Systems Introduction to Microsoft Access Part 1.
SQL SQL Ayshah I. Almugahwi Maryam J. Alkhalifa
Microsoft Office Illustrated Introductory, Windows Vista Edition
End of Access Exam Review.
Plug-In T7: Problem Solving Using Access 2007
Microsoft Office Illustrated Fundamentals
Review of Main Database Features
Building and Using Queries
Using SQL to Prepare Data for Analysis
Structured Query Language (SQL) William Klingelsmith
Database Queries.
Graphical Interface for Queries
Access: SQL Participation Project
Microsoft Office Illustrated Introductory, Windows XP Edition
Assignment 3 Querying and Maintaining a Database
Presentation transcript:

Lecture Access – Queries

What’s a Query? A question you ask a database –ie: “Who are my Stockton customers?” –ie: “How much did Bob sell on the 14th?” A saved set of filters, sorting, and other specifications for later use in a form, report, or to make a new table

Creating a Query Create Ribbon Query Design

Adding Tables to your Query

note the relationship is already created because of the lookup the tables you chose are added to the query

Adding Fields to your Query double-click a field to add it to your query field is added to your query add a few more fields

Run your Query like a table, you can now see the records that resulted from your query Click this icon to go back to design mode

Sort and Filter Use the “Sort” row to specify ways to sort your data. This setting will save with your query for later use. Use the “Criteria” row to specify which rows should stay. Try any combination of these: like "*david*" > 1.25 Between #4/7# and #4/10#

Expressions Expressions allow you to create new fields (in a query) that are calculated from data in other fields. The values of an expression are temporary – they are not “saved” anywhere, they only exist when the query is run.

Why Use Expressions? Modify Text: –Combine strings together –See just the first few letters of a string Calculations: –Commission –Tax –Quantity * Price

Expression Syntax Name of our new Expression A colon (:) The calculation.

Expressions in Use In this query, we have created a new Expression (called “FullName”) that calculates a string based on each record’s First and Last name field. When the Query is run, we can see the results of our new Expression. But… oops! We made a minor mistake.

Entering Expressions Enter directly into Query Builder, or Build using Expression Wizard (right click)

Common Expressions FullName: [FirstName] & " " & [LastName] Earned: [Price] * [Commission] Location: [City] & ", " & [State] & " " & [ZIPCode]

Totals Total row allows you to group, sum, average, etc…

Totals (cont.) In this query, we are telling Access to group by Employee, and sum the Prices. We’re also filtering only for sales between the 1 st and 5 th.

SQL (Structured Query Lang.) special-purpose programming language designed for managing data held in a RDBMS Based on algebra and calculus Data manipulation and data definition –SELECT Book.title AS Title, –COUNT(*) AS Authors –FROM Book –JOIN Book_author ON Book.isbn = Book_author.isbn –GROUP BY Book.title;

SQL, example –SELECT Table.Field, Table.Field, Table.Field, etc, [Field]operator(s)[Field] AS NewFieldName –FROM Table1 INNER JOIN [Table2] ON Table1.PrimaryKeyField = Table2.SameField –ORDER BY Table.Field, Table.Field; **ORDER MATTERS – you cannot organize, sort, etc. until you have established the relationship. The SELECT command must come first and typically the FROM command must immediately follow.

Reports from Queries After a query is created, it can be used as the source data for a report.

Query to Report