DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1 Created By Martin Schedlbauer

Slides:



Advertisements
Similar presentations
Microsoft Access.
Advertisements

Database Design Week 10.
Access Lesson 2 Creating a Database
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
ISP 121 Week 1 Introduction to Databases. ISP 121, Winter Why a database and not a spreadsheet? You have too many separate files or too much data.
Access Tutorial 1 Creating a Database
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
QUERYING A DATABASE By: Dr.Ennis-Cole. OBJECTIVES: Learn how to use the Query window in Design view Create, run and Save queries Define a relationship.
Attribute databases. GIS Definition Diagram Output Query Results.
Concepts of Database Management Sixth Edition
MS Access 2007 IT User Services - University of Delaware.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1.
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
1 Access Lesson 3 Creating Queries Microsoft Office 2010 Introductory.
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Copyright © 2003 by Prentice Hall Module 4 Database Management Systems 1.What is a database? Data hierarchy and data organization Field, record, file,
CPSC 203 Introduction to Computers T59 & T64 By Jie (Jeff) Gao.
Access 2007 Database Application Managing Business Information Effectively BCIS 1 and 2.
Copyright © 2003 by Prentice Hall Computers: Tools for an Information Age Chapter 13 Database Management Systems: Getting Data Together.
ASP.NET Programming with C# and SQL Server First Edition
Concepts of Database Management Seventh Edition
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Data-mining & Data As we used Excel that has capability to analyze data to find important information, the data-mining helps us to extract information.
Introduction to Microsoft Access 2003 Mr. A. Craig Dixon CIS 100: Introduction to Computers Spring 2006.
DATABASE DESIGN USING MICROSOFT ACCESS. What is a Database?  DMS Database management system  Database Collection of data organized in a manner that.
® Microsoft Access 2010 Tutorial 1 Creating a Database.
Microsoft Access 2010 Building and Using Queries.
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.
1 By: Nour Hilal. Microsoft Access is a database software where data is stored in one or more Tables. A Database is a group of related Tables. Access.
Access 2013 Microsoft Access 2013 is a database application that is ideal for gathering and understanding data that’s been collected on just about anything.
WEEK 11 Database Design. TABLE INSTANCE CHARTS Create Tables.
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
Database Systems Microsoft Access Practical #1 Creating Tables Nos 215.
® Microsoft Access 2010 Tutorial 2 Building a Database and Defining Table Relationships.
Concepts of Database Management Seventh Edition
Chapter 17 Creating a Database.
CS1100: Microsoft Access Managing Data in Relational Databases Created By Martin Schedlbauer CS11001Microsoft Access - Introduction.
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.
® Microsoft Office 2013 Access Creating a Database.
CREATING COMPLEX QUERIES WITH NESTED QUERIES CS1100: Data, Databases, and Queries CS1100Microsoft Access1.
Database Management Systems.  Database management system (DBMS)  Store large collections of data  Organize the data  Becomes a data storage system.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Creating Related Tables Creating Related Tables Determining.
CREATING COMPLEX QUERIES WITH NESTED QUERIES CS1100: Data, Databases, and Queries CS1100Microsoft Access1.
Access Forms and Queries. Entering Data in Your Table  You can add data to your table in Datasheet view, by typing in the columns and rows.  This.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
Pasewark & Pasewark 1 Access Lesson 3 Creating Queries Microsoft Office 2007: Introductory.
Concepts of Database Management Eighth Edition Chapter 3 The Relational Model 2: SQL.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
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.
Lesson 2: Designing a Database and Creating Tables.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
CPSC 203 Introduction to Computers T97 By Jie (Jeff) Gao.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
QUERY CONSTRUCTION CS1100: Data, Databases, and Queries CS1100Microsoft Access1.
ACCESS LESSON 1 DATABASE BASICS VOCABULARY. BACKSTAGE VIEW A menu of options and commands that allows you to access various screens to perform common.
Course Contents Overview: Database basics Lesson 1: Benefits of using a database Lesson 2: Table that data Lesson 3: Analyzing, viewing, and reporting.
Database (Microsoft Access). Database A database is an organized collection of related data about a specific topic or purpose. Examples of databases include:
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Microsoft Office Access 2010 Lab 1
GO! with Microsoft Office 2016
Practical Office 2007 Chapter 10
GO! with Microsoft Access 2016
ICT Database Lesson 1 What is a Database?.
Introduction to Access
Topic 12 Lesson 1 – Data and databases
ICT Database Lesson 2 Designing a Database.
Topic 12 Lesson 2 – Retrieving Data with Queries
Presentation transcript:

DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1 Created By Martin Schedlbauer

What is this About Storing, accessing, searching, and viewing data are important in any business. While spreadsheets work well for small amounts of data, databases are used for larger data collections. Learning how to access data is an important skill when working with databases. We will learn how to formulate queries in the Microsoft Access database system. CS1100Microsoft Access - Introduction2

Reasons to Move to a Database Too much data in individual files – Difficult to manage data Have multiple uses for data – Need multiple “views” of the data Need to share the data – Numerous people are entering, deleting, viewing data Need to control the data – Control data values and consistency CS1100Microsoft Access - Introduction3

Value of Knowledge What we learn here is applicable to many other database that are used by businesses: – Oracle – Sybase – Microsoft SQL Server – JavaDB – … We will also learn how to decompose problems and think logically. CS1100Microsoft Access - Introduction4

About Microsoft Access Not available with Mac OS You can use myApps (remotely login to a virtual Northeastern session). (see the course website under Resources -> Software) DOWNLOAD AND SAVE! – You must download and save Access files BEFORE starting to work on them or you will lose your work.laccdb files: file locking is controlled by a locking file with the file name extension.laccdb. – Do not submit this file! Close your file first and the.laccdb file goes away. CS1100Microsoft Access - Introduction5

Relational Databases Microsoft Access is a relational database which means that it stores data in tables – Each table stores information about a single subject Each table contains rows; one row for each record, i.e., a contact, order, product, etc. Each column (or field) contains different kinds of information about the subject Each row in a table has a unique identifier (or key), e.g., OrderID, ProductID, ContactID, etc. CS11006Microsoft Access - Introduction

Relational Databases Each table in the database contains information related to a single subject and only that subject. You can manipulate data about two classes of information (such as customers and orders) based on related data values Example: it would be redundant to store all customer information with every order. – In a relational DB, the table for orders contains one field that stores data such as a customer ID which can be used to connect each order with the appropriate customer information. CS1100Microsoft Access - Introduction7

Relational Databases Microsoft Access is a relational database which means that it stores data in tables. Tables contains records; one row for each record, e.g., a contact, order, product, etc. Tables have attributes; each record has a value for every attribute, e.g., name, price, address… Each row in a table has a unique identifier attribute called a key, e.g., OrderID, ProductID, ContactID, etc. CS11008Microsoft Access

LAYOUT OF THE ORDERS DATABASE Microsoft Access Tutorial: Data, Databases, and Queries CS1100Microsoft Access - Introduction9

The Orders Database We will be using a database that contains data for orders placed by customers for our examples. This database stores the following information: – For each order know what was ordered, how much of that item was ordered, and at what price. – For each order know who placed that order. – For each customer (called a contact) store where they live. – For each product track its description and price. CS110010Microsoft Access - Introduction

The Database Layout These are all of the tables in the database: CS1100Microsoft Access - Introduction11

A Sample Order Order O0001 Customer Contact Contact ID:C0004 Name:Colon, Nicholas Address:9020 N.W. 75 Street Coral Springs, FL Order Date:4/15/1999 Product IDProduct NameQuantityUnitPriceExtendedPrice P0013DVD Disks1 $ P0014HD Floppy Disks4 $ 9.99 $ P0027Norton Anti-Virus1 $ Order Total: $ CS110012Microsoft Access - Introduction

Where Does The Data Come From? Order O0001 Customer Contact Contact ID:C0004 Name:Colon, Nicholas Address:9020 N.W. 75 Street Coral Springs, FL Order Date:4/15/1999 Product IDProduct NameQuantityUnitPriceExtendedPrice P0013DVD Disks1 $ P0014HD Floppy Disks4 $ 9.99 $ P0027Norton Anti-Virus1 $ Order Total: $ CS110013Microsoft Access - Introduction Orders.OrderID Contacts ZipCodes Orders.OrderDate LineItems ExtendedPrice = Quantity * UnitPrice Total Order Amount

A closer look at the Contacts table The Design view – Design your table in this view: CS1100Microsoft Access - Introduction14

Field Data Types Text – alphanumeric data up to 255 characters Memo – alphanumeric data up to 1 gigabyte Number – numeric data Data/Time – dates and times Currency – monetary data AutoNumber – unique value generated by Access for each new record (not editable) CS1100Microsoft Access - Introduction15

A closer look at the Contacts table The Datasheet view – Enter new data in this view CS1100Microsoft Access - Introduction16

Relationships CS1100Microsoft Access - Introduction17 From the Database Tools tab, define how the data in tables is related, such as ID fields in tables that should match. Example: ContactID in the Contact table is related to ContactID in the Orders table – a one-to-many relationship.

RETRIEVING DATA WITH QUERIES Microsoft Access Tutorial: Data, Databases, and Queries CS1100Microsoft Access - Introduction18

Queries Data is retrieved through queries. Queries are formulated in a specialized language called SQL (pronounced SEQUEL). Microsoft Access makes it easy to create SQL queries through a simple drag-and-drop interface called the Query Builder. Queries are eventually integrated into reports, forms, programs, or executed by themselves. CS1100Microsoft Access - Introduction19

Queries on Tables Queries retrieve data from one or more tables. You can specify which – rows to include in the result through filters (WHERE clause in SQL terminology) – columns to include in the results The result of a query is a table that can be used in other queries (as subqueries). CS1100Microsoft Access - Introduction20

Creating Queries in Access To create a query: – Select the Create tab – Pick Query Design – Select the tables to include in the query or simply close the dialog and drag the needed tables into the query designer CS1100Microsoft Access - Introduction21

Running a Query To run a query, click on: To return to the query design, click on: CS1100Microsoft Access - Introduction22

Example: Simple Query Find the contact id, first name, and last name for each contact. CS1100Microsoft Access - Introduction23

Removing Duplicates Queries often result in duplicate rows. These are removed by “grouping rows” with the same value as a single row. To do a Group By, follow these steps: – Select the function button in the ribbon – Select “Group By” for each field CS1100Microsoft Access - Introduction24

Example: Group By Find the dates on which orders were placed. Here’s the result without a Group By: CS1100Microsoft Access - Introduction25 Note the duplicate rows

Example: Group By Here’s the same query with a Group By: CS1100Microsoft Access - Introduction26 Note that the duplicate rows have been “collapsed” into groups and only the group is displayed

Duplicates with Group By Group By collapses all rows that contain the same data across all columns. OrderIDs are not the same in this example so names will show up more than once even if using Group By. CS1100Microsoft Access - Introduction27

Eliminating Duplicates Duplicates can be eliminated by specifying that the query should only return unique records. CS1100Microsoft Access - Introduction28 Watch Demo

Joining Tables A “join” is a query operation in which rows are selected that have a common value for some row. To find contacts that actually placed an order 1, the ContactID column value must be the same in the Contacts and the Orders table. This essentially finds all contacts who placed at least one order. CS1100Microsoft Access - Introduction29 1 There may be contacts in the Contacts table that are not linked to any order, i.e., they never placed an order.

Example: Group By and Join Find the first name, last name, and zip code of all contacts that placed an order. Here’s the result without a Group By: CS1100Microsoft Access - Introduction30 Note the duplicate rows

Example: Group By and Join Find the first name, last name, and zip code of all contacts that placed an order. Here’s the result with a Group By: CS1100Microsoft Access - Introduction31 All rows with the same first name, last name, and zip code have been collapsed into a single “group”

Filtering Selecting rows that meet certain criteria is done through a WHERE clause. CS1100Microsoft Access32 Lists all of the line items (ID only) that have a Quantity > 2.

Selection Criteria Selection criteria are specified as an algebraic relationship, but queries are generally stated as a narrative, so we need to “translate”. CS1100Microsoft Access33 NarrativeAlgebraic Term At least X>= X No more than X< X More than X> X No less than X>= X Less than X< X Up to X< X At most X<= X