HSC IT Center Training University of Florida Microsoft Access Relationships Health Science Center IT Center – Training

Slides:



Advertisements
Similar presentations
Build a database I: Design tables for a new Access database
Advertisements

Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
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.
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
Database A collection of related information stored on a computer and organized in a manner that allows access, retrieval, and use of that data.
Normalization Queries (contd)
Access A Relational Database Management System. Prof. Leighton2 Database ► A database is a collection of data that’s related to a particular topic ► A.
Week 2 Normalization and Queries
Lecture Access – Tables. What are Tables? Records Fields.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
Data Model Examples USER SPECIFICATIONS.
Database Software Application
MS Access 2007 IT User Services - University of Delaware.
Database Relationships Objective 5.01 Understand database tables used in business.
Entity Relationship Diagram Farrokh Alemi Ph.D. Francesco Loaiza, Ph.D. J.D. Vikas Arya.
Database Relationships Objective 5.01 Understand database tables used in business.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1.
MS Access Tutorial MGMT 683 J. Rees. Introduction MS Access is a relational database management system (RDBMS) Other PC-based RDMBS include: –MS FoxPro.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1 Created By Martin Schedlbauer
Microsoft Access 2000 Creating Tables and Relationships.
Food Recall System Pre Code System Design Layout Version 1.0.
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.
LSP 121 Week 2 Normalization and Advanced Queries.
Relational Database Concepts. Let’s start with a simple example of a database application Assume that you want to keep track of your clients’ names, addresses,
Introduction to Database Concepts and Microsoft Access 2010 Academic Health Center Training (352)
Microsoft Access Understanding Relationships Academic Health Center Training (352)
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.
To enhance learning, service, and research through an advanced information technology environment. Our Mission:To enhance learning, service,and research.
HSC IT Center Training University of Florida Introduction to Database Concepts and Microsoft Access.
DATABASE DESIGN USING MICROSOFT ACCESS. What is a Database?  DMS Database management system  Database Collection of data organized in a manner that.
Microsoft ® Office Access ® 2007 Training Build a database I: Design tables for a new Access database ICT Staff Development presents:
Relational Databases (MS Access)
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
1.NET Web Forms Business Forms © 2002 by Jerry Post.
Microsoft Access Big City Store Sales Database CUSTOMERS First Last Address City State Zip PRODUCTS Product Supplier Description Units Cost Price SALES.
Database Design. Referential Integrity : data in a table that links to data in another table must always work in such a way that following the link will.
Database What is a database? A database is a collection of information that is typically organized so that it can easily be storing, managing and retrieving.
HSC IT Center Training University of Florida Introduction to Database Concepts and Microsoft Access 2007 Health Science Center IT Center – Training
IST 220 – Intro to Databases Analyzing Data Needs.
Microsoft Access Intro Class 6 Relationships.
Microsoft Access 2010 Crash Course Part 1 Academic Health Center Training (352)
HSC IT Center Training University of Florida Microsoft Access Understanding Relationships Health Science Center IT Center – Training
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Introduction to Database using Microsoft Access 2013 Part 7 November 19, 2014.
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
IBS 520 Introduction to Internet Technology Database Fundamentals Week 4.
DAY 15: ACCESS CHAPTER 1 Rahul Kavi October 6,
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,
Quiz questions. 1 A data structure that is made up of fields and records? Table.
Database Terms Hernandez, Chapter 3. Data/Information The values you store in the database are data. Pieces of Data in and of themselves is not particularly.
Microsoft Access is a database program to manage sort retrieve group filter for certain records.
Database design Using Access 2007
* 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.
Part 1.  To answer the question “what is a database?”  To understand the basic components of a database and start to plan/create our own.
CSCI 6962: Server-side Design and Programming Shopping Carts and Databases.
QUERY CONSTRUCTION CS1100: Data, Databases, and Queries CS1100Microsoft Access1.
Introduction to Database Concepts and Microsoft Access 2007 Presented By: Mr. Kenver Regis.
Database Relationships
Microsoft Office Access 2010 Lab 1
Prepared By: Bobby Wan Microsoft Access Prepared By: Bobby Wan
Creating a Simple Database with Microsoft Access 2007
Database Relationships
Introduction to Database Concepts and Microsoft Access 2000
Introduction to Database Concepts and Microsoft Access 2003
Microsoft Applications
Database Relationships
Microsoft Access Understanding Relationships
Joins and other advanced Queries
Microsoft Access Date.
Presentation transcript:

HSC IT Center Training University of Florida Microsoft Access Relationships Health Science Center IT Center – Training

HSC IT Center Training University of Florida What is a Relational Database? A relational database is a collection of tables from which data can be accessed in many different ways without having to reorganize the database tables. – That is, the tables can “talk” to each other. We can link (relate) our tables to find: Which doctors are seeing a patient Which students are in which class Which item is selling the most on Friday’s

HSC IT Center Training University of Florida What is a Relational Database? A relational database allows data structures, storage and retrieval operations, and integrity constraints. – Integrity constraints provide a way of ensuring that changes made to the database by authorized users do not result in a loss of data consistency

HSC IT Center Training University of Florida Review of the Basic Design Rules of Relational Databases Unique Field Names – Keep fields unique across tables, and keep them as clear as possible in each table. No Calculated or Derived Fields – Calculations and derivations can be performed in Queries, Forms and Reports. Doing them in a table only increases the chance of data entry error.

HSC IT Center Training University of Florida Review of the Basic Design Rules of Relational Databases Data is broken down into Smallest Logical Parts – Smallest “Sortable” parts. Remember it’s much easier to pull fields together than it is to pull a field apart. Unique Records – Each of your tables should have unique records. We ensure this by setting one field to be a Primary Key. This can be a user generated field or an AutoNumber.

HSC IT Center Training University of Florida Table of Yards Yards Yard Number Owner Address Phone Number

HSC IT Center Training University of Florida Table of Birdfeeders Bird Feeders Bird Feeder Number Material - Wood, Plastic, Metal Location in Yard - Sun, Partial/Full Shade

HSC IT Center Training University of Florida Relating Yards and Birdfeeders Bird Feeders Bird Feeder Number Material Location in Yard Yards Yard Number Owner Address Phone Number There must be one field in both tables that is the same, so that the database knows how the tables connect. It’s best to use the Primary key as the link.

HSC IT Center Training University of Florida Relating Yards and Birdfeeders Bird Feeders Bird Feeder Number Material Location in Yard Yards Yard Number Owner Address Phone Number Bird Feeder Number 1 Bird Feeder Number 2... If we put the Birdfeeder in the Yard table, we will have to count each one. BF1, BF2... Whenever you find yourself numbering the fields in this way, it’s a sign you’re on the wrong track

HSC IT Center Training University of Florida Relating Yards and Birdfeeders Bird Feeders Bird Feeder Number Material Location in Yard Yard Number Yards Yard Number Owner Address Phone Number But if we reverse the direction, the link (relationship) makes more sense. Each Birdfeeder can only be in one Yard, but each Yard can have many Birdfeeders. This is called a one to many (1 - ∞ ) Relationship.

HSC IT Center Training University of Florida One to Many Relationships One Birdfeeder is visited by Many Birds One Yard contains Many Birdfeeders One Patient has Many Prescriptions One Insurance has Many Patients One Student attends Many Classes One to Many relationships are the most common relationships. A record MUST be in the One table in order to appear in the Many table. One to Many includes One to None.

HSC IT Center Training University of Florida One to Many Relationships 1 ∞ Medical Record # Patients Prescription Number Medical Record # Medications Primary Key linked to Non Primary Key

HSC IT Center Training University of Florida One to One Relationships One Birdfeeder is located in One place in the Yard One Yard has One Address One Patient has One Home Phone Number One Insurance has One Contact Person One Student has One Gatorlink ID One to One relationships can often combine the data into one table.

HSC IT Center Training University of Florida One to One Relationships 1 1 Medical Record # Patients Medical Record # Address Patient Info Primary Key linked to Primary Key

HSC IT Center Training University of Florida One to One Relationships Reasons you may use a One to One… You have more than 255 fields the maximum number of columns (fields) You have limited information for some fields i.e. we have 4000 patients, but only 100 address. We can keep the s in another table, with the same primary key.

HSC IT Center Training University of Florida Many to Many Relationships Many Students are taught by Many Teachers Many Patients see Many Doctors Many Medications are taken by Many Patients Many Customers buy Many Products Many to Many relationships are also very common. You cannot create a “true” relationship between these tables.

HSC IT Center Training University of Florida Many to Many Relationships ∞ ∞ Shands Medical Record # Medicare Patients Prescription Number Shands Medical Record # Medications Non Primary Key linked to Non Primary Key Access sees this as an Indeterminate relationship You cannot Enforce Referential Integrity

HSC IT Center Training University of Florida Indeterminate Relationships Indeterminate relationships are often found when we are linking tables, because Linked Tables cannot have a primary key. If you have imported or created a table, it’s very rare to have a need for an indeterminate Relationship. These relationships show Access that the data saved in the field from the first table is the same kind of data saved in the second table, but there can be no data integrity rules applied on indeterminate relationships.

HSC IT Center Training University of Florida Sales Database CUSTOMERS Customer ID First Last Address City State Zip PRODUCTS Product ID Product Supplier Description Units Cost Price Jack bought: 2 Hats 4 Pairs of Socks 3 Pairs of Shoes Shoes bought by: Jack Johnson Jill Jones Jerry Jacks

HSC IT Center Training University of Florida Sales Database Many to Many Relationship CUSTOMERS Customer ID First Last Address City State Zip PRODUCTS Product ID Product Supplier Description Units Cost Price  

HSC IT Center Training University of Florida Sales Database CUSTOMERS Customer ID First Last Address City State Zip PRODUCTS Product ID Product Supplier Description Units Cost Price Customer1 Customer2 Customer One Product can be purchased by an unlimited number of Customers.

HSC IT Center Training University of Florida Sales Database CUSTOMERS Customer ID First Last Address City State Zip Product1 Product2 Product PRODUCTS Product ID Product Supplier Description Units Cost Price One Customer can purchase an unlimited number of Products.

HSC IT Center Training University of Florida Sales Database CUSTOMERS Customer ID First Last Address City State Zip PRODUCTS Product ID Product Supplier Description Units Cost Price SALES Sales ID Customer ID Product ID Date Quantity Junction Table Main Table

HSC IT Center Training University of Florida Sales Database CUSTOMERS Customer ID First Last Address City State Zip PRODUCTS Product ID Product Supplier Description Units Cost Price SALES Sales ID Customer Product Date Quantity 1 One Customer can have many sales  1 One Product can be sold many times 

HSC IT Center Training University of Florida Sales Database Each Sale Customer ____________________ Product______________________ Date___________ Qty__________ A lookup can be created for the Customer and Product tables, such that the Sale Table will have two lookups, a Date and a Qty field. CustomerProductDateQty

HSC IT Center Training University of Florida Sales Database Products by Customer First ____________ Last __________________ Address ______________________________________ City_____________ State ____Zip Code ________ ProductDateQty

HSC IT Center Training University of Florida Sales Database Customers by Products Product __________________________________ Supplier__________________________________ Description _______________________________ Units_________Cost______Price________ CustomerDateQty

HSC IT Center Training University of Florida Examples Patients Patient ID First Last Address City State Zip Medications Med ID Medication Description

HSC IT Center Training University of Florida Examples Patients Patient ID First Last Address City State Zip Medications Med ID Medication Description Patient Meds PM ID Patient ID Med ID Dosage Directions 1 One Patient can take many Medications  1 One Kind of Medication can be taken by Many Patients 

HSC IT Center Training University of Florida Examples Patients Patient ID First Last Address City State Zip Primary Drs Doc ID Name Phone Pager

HSC IT Center Training University of Florida Examples Patients Patient ID First Last Address City State Zip Primary Drs Doc ID Name Phone Pager One Patient will have only ONE primary Doctor. One Primary Doctor can have MANY patients. Primary Doc 1 

HSC IT Center Training University of Florida Examples Patients Patient ID First Last Address City State Zip Emergency Contact Patient ID EC Name EC Phone

HSC IT Center Training University of Florida Examples Patients Patient ID First Last Address City State Zip Emergency Contact Patient ID EC Name EC Phone One Patient will have only ONE emergency contact. One Emergency contact will belong to only ONE patient. 1 1 It is feasible that many patients would have the same contact or that one patient could have many contacts. But not in this example.

HSC IT Center Training University of Florida Let’s Practice…