LSP 121 Week 2 Normalization and Advanced Queries.

Slides:



Advertisements
Similar presentations
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Advertisements

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.
ISP 121 Access Normalization and Relationships. Normalization Say we’re operating a pet day-care and we need to keep information on our pets/customers.
Database A collection of related information stored on a computer and organized in a manner that allows access, retrieval, and use of that data.
© Steven Alter, 2007, all rights reserved Database concepts Difference between a database and the Internet Reason for having a defined data structure Relational.
Normalization Queries (contd)
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.
Week 2 Normalization and Queries
Database Basics. Definitions Database Relational database Table Record Field Primary key.
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.
LSP 121 Week 2 Normalization and Queries. Normalization The Old Car Club database presented a problem – what if one person owns multiple cars? (One owner.
Access Lecture 1 Database Overview and Creating Tables Create an Employee Table.
Business Computer Information Systems Microsoft Office XP Access Review Lessons 1 through 5.
Advanced Tables Lesson 9. Objectives Creating a Custom Table When a table template doesn’t suit your needs, you can create a custom table in Design view.
INF1050- Databases In this module you will use Microsoft Access to create digital databases.
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
Access 2007 Database Application Managing Business Information Effectively BCIS 1 and 2.
LSP 121 Week 1 Intro to Databases. Welcome to LSP 121 Quantitative Reasoning and Technological Literacy II Continuation of quantitative data concepts.
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Lesson 1 -What is a Database? -Fields and Records
Database Relationships. Types of Relationships One to one – Person to Driver’s License, Country to President, Person to Social Security Number (in theory)
Exploring Microsoft Access Chapter 4 Relational Databases, External Data, Charts, and the Switchboard.
10 May Microsoft Access 2010 Relational databases’ program Part of the Microsoft Office package Administer relational database Update database through.
DATABASE DESIGN USING MICROSOFT ACCESS. What is a Database?  DMS Database management system  Database Collection of data organized in a manner that.
What is a Database? A Database is…  an organized set of stored information usually on one topic  a collection of records  a way to organize information.
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.
1 Advanced Topics in Access How to create forms and reports Andrew Yu 03/04/2002.
Concepts of Database Management Seventh Edition
Database Systems Microsoft Access Practical #3 Queries Nos 215.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
Microsoft Access Intro Class 6 Relationships.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T7 PROBLEM SOLVING USING ACCESS.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
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.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/Programs/Microsoft Office/Microsoft Office.
Introduction to a Database Defining a database Database window in Access The six items in window: Tables, Queries Forms, Reports, Macros, Modules.
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.
Introduction to Access Chapter 13 pages 1-4. What is a database??? Related information is stored in databases  All SC student information is stored in.
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.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/All Programs/Microsoft Office/Microsoft Office.
Access Lessons 1, 2 and 3 ©2009 M and K Solutions, LLC – All Rights Reserved.
Database design Using Access 2007
Customizing Reports Adding a Date to a Report Reference Window Adding a Date to a Report Display the report in the design view Click the Text Box Tool.
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
Connecting (relating) Data Tables to get Custom Records (Queries) Database Basics.
Exploring Microsoft Access Chapter 5 One-to-Many Relationships: Subforms and Multiple Table Queries.
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.
Access Queries and Forms. Adding a New Field  To insert a field after you have saved your table, open Access, and open the table  It is easier to add.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T7: Problem Solving Using Access 2007 Business Driven Technology.
Notes: **A Row is considered one Record. **A Column is a Field. A Database is…  an organized set of stored information usually on one topic  a collection.
Access Lessons 1, 2 and 3 ©2009 M and K Solutions, LLC – All Rights Reserved.
Access Queries and Forms. Access Queries Simple Queries  To create an Access query, don’t use the query wizard. Instead, create query in Design view.
Decision Analysis Fall Term 2015 Marymount University School of Business Administration Professor Suydam Week 10 Access Basics – Tutorial B; Introduction.
Week 1 Intro to the Course Intro to Databases.  Formerly ISP 121  “Continuation” of LSP 120 concepts  Topics include: ◦ Databases ◦ Basic statistics.
Plug-In T7: Problem Solving Using Access 2007
Database Relationships
Review of Main Database Features
Database Relationships
Introduction to Access 2003
Microsoft Official Academic Course, Access 2016
Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design
Presentation transcript:

LSP 121 Week 2 Normalization and Advanced Queries

Normalization Let’s create a database for a car club What if one person owns multiple cars? (One owner can have many cars, so this is 1:M relationship) Create a separate table for just the cars How do you “relate” the two tables together?

Normalization Example Car Club (originally) Member ID (primary key) Member Name Member Address Member City Member State Member Zip Member Phone Dues Paid? National Member? these fields repeat 1 to n times Model of Car Make of Car Year of Car Member Table Member ID (primary key) Name Address City State Zip Phone Dues Paid? National Member? Car Table Model of Car Make of Car Year of Car Member ID (not a primary key here!) Primary Key in Member Table? Foreign Key in Car Table? 1:M Relationship

Another Example Student Records Student ID (primary key) Name Address City State Zip Phone these fields repeat 1 to n times Class Name Grade Number Credits Major Minor Degree Sought Student Info Student ID Name Address City State Zip Phone Major Minor Degree Sought Grades Class Name Grade Number Credits Student ID Before After

Let’s Consider the Following: Sales Transactions at a Clothing Store Customer ID Customer Last Name Customer Phone Customer City following fields repeat 1 to n times: Sales Transaction Date Sales Amount Item Clearance Item? Let’s first create the two tables using paper and pencil.

Relationships If: – you create two tables, and – the first table has a primary key, and – you carry that primary key over to the second table as a foreign key, and – the primary key and the foreign key are spelled the same and have the same type Then Access will automatically create a relationship between the two tables

Relationships You can also create a relationship between the two tables by hand Go to the Tools drop-down menu and click on Relationships Add the two tables to the view, click on one of the Student IDs and drag it over to the other Student ID and un-click Check Enforce Referential Integrity (you don’t want children records without parents)

Why Relational? Eliminates redundancy Makes adding data easier Allows for more secure access to only parts of the data Now let’s create our tables and enter our data into Access (data is on the next slide)

Data  1Smith Palos Heights  2Chen LaGrange  3Wilson Chicago  3/3/ ShirtY1  3/3/095.99ScarfN1  3/4/ JeansY3 This is the foreign key

Simple Queries To create an Access query, don’t use the query wizard. Instead, create query in Design view Let’s see how Access does it List all customer names and phone numbers List customer name, sales date, sale price and item name of all clearance items sold List customer name, sales date, sale price and item name of all clearance items sold on 3/3/09

Queries You can look for something after a certain date IF the data was stored as date/time and you say >1/1/2004 Dates should be entered with # before and after the date, and can be in many different formats, ie #1/1/2004#, #January 1, 2004#, #1-Jan-2004#

Queries Logical OR - You can look for records in the state of Indiana or Illinois by saying “IL” OR “IN” You can also say: In (“IL”, “IN”, “OH”) Logical AND - you can make multiple entries in the query boxes. For example, in the State field enter “IL” and then in the Size field enter <3

Queries Logical AND - You can also use an AND in one field. For example, in the Size field you can enter >=3 AND <=9 A slightly easier way of doing this is using the BETWEEN operator: Between 3 and 9 Possible operators include =, <>,, = Let’s stop here for now and do Activity 3

Queries That Calculate When performing a query, you can aggregate the data You can perform a Count, Sum, Avg, Max, Min, StDev, Var(iance), First, and Last Count, First, and Last can be performed on types counter, number, currency, date/time, yes/no, text, memo, and OLE object Sum, Avg, Max, Min, StDev, Var can be performed on types on counter, number, currency, date/time, and yes/no

Example Say you have a database for a vet (the pets database on QRC website) If you want to find the average weight and height of all pets: (you may have to click on View / Totals) Field: Pet IDWeightHeight Total: CountAvgAvg Show: X X X

Example What if you want to find the average height and weight for all dogs? Field: WeightHeightType of Animal Total: AvgAvgGroup By Show: X X X Criteria:“Dog”

Example What if you want to find the minimum and maximum weight for all dogs? Field: WeightWeightType of Animal Total: MinMaxGroup By Show: X X X Criteria:“Dog”

More Examples You can also perform totals on groups of records. For example, suppose you want to count how many different types of pets the vet has on record Field: Type of AnimalPet ID Total: Group ByCount Show X X

Further Examples? Let’s play with the Pets database some more Now we can do Activity 4