Relational Queries (query 12) Display vendor contact info (contact person and phone number) for inventory products (relationship query) Query: Inventory.

Slides:



Advertisements
Similar presentations
Database Relationships in Access As you recall, the data in a database is stored in tables. In a relational database like Access, you can have multiple.
Advertisements

Objectives Create an action query to create a table
© Paradigm Publishing, Inc Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 2Creating Relationships between Tables.
MS-Access XP Lesson 2. Input Mask Property 1.Field : Phone No Data Type : Number Input Mask : Character 0 represent a single digit and phone.
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 3 1 Microsoft Office Access 2003 Tutorial 3 – Querying a Database.
SUNY Morrisville-Norwich Campus-Week 10 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
RELATIONSHIP  THE WAY TABLES ARE RELATED  A TABLE MUST PARTICIPATE IN AT LEAST ONE RELATIONSHIP  IN A BINARY RELATIONSHIP TWO ENTITIES PARTICIPATE 
Querying a Database Microsoft Office Access 2003.
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
Lesson 32: Designing a Relational Database. 2 Lesson Objectives After studying this lesson, you will be able to:  Identify and apply principles for good.
Computer Science & Engineering 2111 Introduction to Database Management Systems Relationships and Database Creation 1 CSE 2111 Introduction to Database.
Define Table Relationships—1 of 3 One of the most powerful features of a relational database management system, such as Access, is its ability to define.
Microsoft Access Lesson 3
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Primary & Foreign Keys. PK & FK 1.Primary key is required 2.The PK must be unique 3.If the primary key from one table is related to a field in another.
Microsoft Access – Tutorial 3
CS&E 1111 AcInnerJoins Inner Joins Objectives: Creating Queries with data from Multiple Tables Joining two tables using an Inner Join Referential Data.
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
IE 423 – Design of Decision Support Systems Database development – Relationships and Queries.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 9 – Building Links,
Office Management Tools II Ms Saima Gul.  When you create your tables, you should assign each table a primary key—one or more fields whose contents are.
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
Intro to Access & Macros CSCI130-03A Instructor: Dr. Imad Rahal LAYEROrder Application SW: Excel & Access 2 High-order P.L.: Visual Basic1 Low-order P.L.:
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the database.
Microsoft Access Intro Class 6 Relationships.
Using Microsoft Access 56:150 Information System Design.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Part II. Query Types On the design query table pane, right click and the cascading window will appear.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Tutorial 9 Using Action Queries and Advanced Table Relationships.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Creating Related Tables Creating Related Tables Determining.
Microsoft Access 2013 ®® Tutorial 9 Using Action Queries and Advanced Table Relationships.
ACCESS Part 2. OBJECTIVE  Use the Query Wizard.  Work with data in a query.  Use Query Design View.  Sort and find data.  Filter data Apply AND criteria.
Database Processing with Microsoft Access Appendix DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
1 CHƯƠNG 4 Creating Relational Databases Understanding Table Relationships Example: This database tracks customers and their orders in two separate.
Manipulating Data Lesson 3. Objectives Queries The SELECT query to retrieve or extract data from one table, how to retrieve or extract data by using.
Review Types of Relationship – there are in general three different types of relationships - One to One – where each record in one table can have not more.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Access Tutorial 2 Building a Database and Defining Table Relationships
Microsoft Office Access 2010 Lab 1
Tables & Relationships
Microsoft Access 2016 Design and Implement Powerful Relational Databases Chapter 6.
COP 4540 Database Management
Microsoft Access – Tutorial 3
Basic Database Concepts
Inner Joins Objectives: Creating Queries with data from Multiple Tables Joining two tables using an Inner Join Referential Data Integrity Cascade Update.
Objectives Query for top values Create a parameter query
and Defining Table Relationships
SQL MODELER - OPEN There are Three Ways to open the SQL Modeler
Objectives Create an action query to create a table
CIS 155 Table Relationship
Database Relationships
Microsoft Access 2003 Illustrated Complete
Design and Implement Powerful Relational Databases Chapter 6
Microsoft Office Access 2003
MS Access: Using Advanced Query Features
Tutorial 3 – Querying a Database
Insert, Update, Delete Manipulating Data.
Access Lesson 2 Creating a Database
Microsoft Office Access 2003
Access Tutorial 2 Building a Database and Defining Table Relationships
Creating a Master-Detail Form
Tutorial 9 Using Action Queries and Advanced Table Relationships
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

Relational Queries (query 12) Display vendor contact info (contact person and phone number) for inventory products (relationship query) Query: Inventory Product Info

EMPLOYEES Employee#* Department DEPARTMENTS Department name* Inventory Product number* PURCHASE ORDERS Product number Emp Number 1 M 1 M Relational Concepts Employees of a department make orders for requested products Not all tables are linked Only related ones Two tables can have multiple relationships Table relationships/links can be One-to-many One department can have many employees One-to-one In Access, can’t be many-to-many

Steps for Designing a Database Understand application Determine the entities in your business Determine what tables you need What properties (fields) does each table have? What is the key of each table? How to link tables?

Using Multiple Tables Linked fields don’t need to have the same name E.g. Department & Department name But must contain data of same data type Field must be key in at least one table primary table vs. related table Referential Integrity: Every department in EMPLOYEES (related table) must exist in DEPARTMENTS (primary table) The link is activated by a Join operation Inner Join Left Outer Join Right Outer Join Try Vendors and Inventory

Using Multiple Tables How to create relationships between tables? Relationship window Tools  Relationships Add tables to window Right Click  Show Table Remove tables from window Select Table Right Click  Hide Table Join tables Click on the field of one table and drag it over to the corresponding field in the other table A window appears that describes the relationship

Key Field 3 Types of Joins 1 to many Used when a record of Departments (primary (1st) table) has its Join field changed  what would happen to corresponding fields in Employees (related (2nd) table) records? If not clicked  no ref. integrity If clicked  Every record in related Table must have a matching record in primary table; two other boxes  Cascade Update  Cascade Delete

The 1 is for the primary table Referential Integrity: We can’t have a record in the related table that has no matching record in the primary table Cascade Update  If join field of some record in primary table is updated then update corresponding field in related table records E.g., “Design”  “Development” in Departments, then automatically all “Design” in Employees become “Development” Cascade Delete  If record of some join field in primary table is deleted then delete corresponding records related table E.g. if we delete the “Design” department from Departments, then automatically delete all Employees record in the “Design” Department

Types of Joins Decide how we go about concatenating records from related tables into 1 table 3 options are given : Reason: not all records in primary table have matching records in related table E.g. Department = { (‘CSCI’, SJU), (‘MGMT’, SJU) , (‘ACCT’, CSB)} Student (name, Department) … 2 CSCI, 1 MGMT and 2 HIST Inner Join (1): includes data only from records have matches records in both tables Left Outer Join (2): includes all records from primary even those that have no matches in related Right Outer Join (3): includes all records from related even those that have no matches in primary in case referential integrity is not specified NO JOIN!

Types of Joins (Query that JOINS Purchase Orders & Inventory) Drop Join and show result Inner Join: Inventory items with outstanding purchase orders Left Outer Join: All inventory items will be included even those with no outstanding purchase orders Right Outer Join: All items with outstanding purchases are included even those not in inventory NO JOIN!