Database Relationships

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?
Relationships Relational Database. Identifying Entities… In the previous tutorial you learnt about identifying entities in a flat file database. Also.
UNIVERSITY OF PALESTINE business computer application College of Business Instructor: Mr. Ahmed Abumosameh.
Microsoft ® Office Acess 2003 Training An Intro Guide to Acess 2003 Mr Garel…… presents:
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
Databases and Database Management Systems
Database Software Application
Computer Science & Engineering 2111 Introduction to Database Management Systems Relationships and Database Creation 1 CSE 2111 Introduction to Database.
Database Relationships Objective 5.01 Understand database tables used in business.
Entity-Relationship Design
Database Relationships Objective 5.01 Understand database tables used in business.
Database Tables two order-entry scenarios: A customer wants to cancel an order that she's placed. If her address is in a separate table from her.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
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,
Microsoft Access Understanding Relationships Academic Health Center Training (352)
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
Relational databases and third normal form As always click on speaker notes under view when executing to get more 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.
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database.
1 Database Concepts 2 Definition of a Database An organized Collection Of related records.
Databases. What is a database?  A database is used to store data. The word DATA is actually Latin for FACTS. A database is, therefore, a place, or thing.
Microsoft Access Intro Class 6 Relationships.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
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?
Microsoft ® Office Access 2003 Training Get to know Access CGI presents:
26 Mar 04 1 Application Software Practical 5/6 MS Access.
Quiz questions. 1 A data structure that is made up of fields and records? Table.
Lesson 2: Designing a Database and Creating Tables.
1 MS Access. 2 Database – collection of related data Relational Database Management System (RDBMS) – software that uses related data stored in different.
Information Access Mgt09/12/971 Entity-Relationship Design Information Level Design.
D1 FMA Review. Many-to-Many Relationships - Examples Car Hire –A customer may hire one or more cars –A car may be hired by one or more customers Gym Club.
Database Relationships Objective 5.01 Understand database tables used in business.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
1 Finding Your Way Through a Database Exploring Microsoft Office Access.
Microsoft Access 2013 ®® Case Study Creating a Database.
Database Relationships
Microsoft Office Access 2010 Lab 1
Prepared By: Bobby Wan Microsoft Access Prepared By: Bobby Wan
Tables & Relationships
Introducing Databases
Implementing an REA Model in a Relational Database
Microsoft Office Access 2010 Lab 3
View Integration and Implementation Compromises
Databases Chapter 9 Asfia Rahman.
Creating a Database Microsoft Access.
Information Systems Today: Managing in the Digital World
Database Normalization
CIS 155 Table Relationship
Database Management Systems (DBMS)
Microsoft Office Illustrated Fundamentals
Introduction to Database Systems
CSCI-100 Introduction to Computing
Database Fundamentals
RELATIONAL DATABASE MODEL
Case Study Creating a Database
Database Fundamentals
5.02 Understand database queries, forms, and reports used in business.
Relational Queries (query 12) Display vendor contact info (contact person and phone number) for inventory products (relationship query) Query: Inventory.
Database Relationships
Flat Files & Relational Databases
Database Fundamentals
logical design for relational database
Microsoft Access Understanding Relationships
Introducing a Database
Nagendra Vemulapalli Access chapters 1&2 Nagendra Vemulapalli
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

Database Relationships

Relationships One of the great benefits of working with databases is the ability to store huge quantities of information. One company’s database may contain many tables of related information. When the information between tables is linked, it is called a relationship. Since the database information is associated, the database can pull all the information together whenever you want in ways that you specify. Examples of separate types of data (paragraph 1) In the recycling club database, member contact information is stored separately from lists of recycling volunteers or holiday planning data. Example of associated data (paragraph 2) Recycling club member Nancy Davolio’s name is associated with, or “knows about,” Nancy Davolio’s contact information, which is stored in another set of data. Creating a relational database means you can quickly pull information together. For example, you can quickly print a list of who's volunteered to recycle newspapers this Saturday, along with their up-to-date addresses and phone numbers. Relationships link data from individual tables to increase the usefulness of the database. 5.01 Understand database tables used in business 5.01 Database Relationships

Relationships Table relationships increase the power of the database by allowing data to be stored separately, but managed and retrieved collectively. 5.01 Database Relationships

Relationship Example What are the advantages of this system? Are there disadvantages? A music store database contains three tables. An Inventory table is linked by artist to a Royalty table which contains the artist’s contact information and royalty percentages The Inventory table is also linked to a Sales table by salesperson ID numbers, which contains employee information and commission rates Once a purchase is made, the inventory is adjusted in one table and the artist’s royalties and employee’s commissions are calculated from the information in the other tables 5.01 Database Relationships

Keys to the Relationship A primary key unlocks the relationship potential of a table by creating a unique link between tables The related field between the two tables must be of the same data type and size A join line represents the relationship between tables graphically 5.01 Database Relationships

Primary and Foreign Keys When tables relate, the primary key of one table becomes a foreign key of the other table For example, in the two tables on the right, Employee ID appears in the Employees Table as a primary key… …and in the Orders Table as a foreign key Foreign key – when tables are linked by the primary key, the related field in the second table is known as the foreign key A detailed example of how primary keys and foreign keys work Let’s say you have an Employees table and an Orders table. The Employee ID number is the primary key for the Employees table and a foreign key for the Orders table. The Orders table has its own primary key, the Order ID number. When Nancy Davolio takes an order, her Employee ID number is entered into the Orders table. This ID number refers to the details about Nancy in the Employees table, so there's no need to repeat data about Nancy (such as her phone extension) in the Orders table. We’ll go into more detail about primary keys, foreign keys, and table relationships later in the presentation. 5.01 Database Relationships

Referential Integrity Referential integrity protects related data that is stored in multiple tables. It would prevent a customer in a customers table from being deleted if the customer’s ID also appears in the order table

Example Referential integrity would prevent two cars from being assigned to the same driver or two cars from being assigned the same ID number. It would also prevent a driver from being deleted from a table if the driver is assigned to a car.

What does a relationship look like? One record in the Student Table is related to one record in the Participation Table Relationship established between two tables 5.01 Database Relationships

Setting up a Relationship Add one table’s primary key to a like field with the same properties in another table In order to decide which table’s primary key to use you must first determine the nature (type) of the relationship There are 3 types of relationships 5.01 Database Relationships

One-to-One Only one matching record between two tables This relationship is the least common because it is not a very efficient use of tables 5.01 Database Relationships

One-to-Many Most common type of relationship One record in Table A links to multiple records in Table B For example: A list of suppliers for the music store is contained in Table A. It is linked by the supplier ID field to Table B which contains all of the products used by the music store. When Table B is searched for a specific product (record), such as a CD carrying case, the manager can view the supplier’s contact information, which is stored in Table A. 5.01 Database Relationships

Many-to-Many Multiple records in Table A are linked to multiple records in Table B For example: In the music store database, Table A contains customer information and Table B contains CD inventory. A record for Bob from Table A may be linked to several records of CDs in Table B by linking the Customer ID fields. If Table B contains the CD inventory, a record for a particular CD can be linked to several customers in Table A. 5.01 Database Relationships

Function of the Junction Table A junction table is used with many to many relationships to join primary key fields of multiple tables For example, in a Music Store database, the primary key fields of the Orders, Musicians, Inventory, and Prices tables are all contained in a separate table, which acts like a hub for the tables of the database