1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database.

Slides:



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

Microsoft Access.
Database Creation and Management
UNIVERSITY OF PALESTINE business computer application College of Business Instructor: Mr. Ahmed Abumosameh.
Access Lesson 2 Creating a Database
Exploring Microsoft Access 2003 Chapter 6 Many-to-Many Relationships: A More Complex System.
SUNY Morrisville-Norwich Campus-Week 10 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
Accounting Databases Chapter 2 The Crossroads of Accounting & IT
Database Relationships Objective 5.01 Understand database tables used in business.
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 ® Office Access ® 2007 Training Build a database III: Build relationships for a new Access database ICT Staff Development presents:
 An entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationships between entities in a database.  An Entity Relationship.
Database Relationships Objective 5.01 Understand database tables used in business.
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
Microsoft Access Lesson 3
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
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.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
XP Chapter 2 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Building The Database Chapter 2 “It is only the farmer.
Principles of Database Design, Part II AIMS 2710 R. Nakatsu.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
Microsoft ® Office Access ® 2007 Training Build a database I: Design tables for a new Access database ICT Staff Development presents:
® Microsoft Office 2010 Access Tutorial 2 Building a Database and Defining Table Relationships.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
© 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,
WEEK 11 Database Design. TABLE INSTANCE CHARTS Create Tables.
Database Systems Microsoft Access Practical #1 Creating Tables Nos 215.
CPSC 203 Introduction to Computers Tutorial 03 & 29 By Jie (Jeff) Gao.
Chapter 17 Creating a Database.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T6: Basic Skills and Tools Using Access 2010 Business Driven Technology.
Microsoft Access Intro Class 6 Relationships.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
® Microsoft Office 2013 Access Creating a Database.
IST 220 Introduction to Databases Course Wrap-up.
Microsoft Access 2013 Design and Implement Powerful Relational Databases Chapter 6.
Exploring Microsoft Access Chapter 6 Many-to-Many Relationships: A More Complex System.
Introduction to Database using Microsoft Access 2013 Part 7 November 19, 2014.
Microsoft Access 2013 ®® Tutorial 9 Using Action Queries and Advanced Table Relationships.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
McGraw-Hill/Irwin © The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T6 Basic Skills Using Access.
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.
Access Review. Access Access is a database application A database is a collection of records and files organized for a particular purpose Access supports.
Database revision.
Relational Theory and Design
Build a database III: Build relationships for a new Access database Overview: You can relate This course teaches you how to build relationships between.
Lesson 2: Designing a Database and Creating Tables.
1 CHƯƠNG 4 Creating Relational Databases Understanding Table Relationships Example: This database tracks customers and their orders in two separate.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
Work with Tables and Database Records Lesson 3. NAVIGATING AMONG RECORDS Access users who prefer using the keyboard to navigate records can press keys.
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.
Logical Database Design and the Relational Model.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
Howard Paul. Sequential Access Index Files and Data File Random Access.
Database Relationships Objective 5.01 Understand database tables used in business.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
Teanna Clarke 6aQ What is a Entity-Relationship Diagram?  An Entity-Relationship Diagram (ERD) is a tool that graphically shows the connections among.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
Databases: What they are and how they work
Tables & Relationships
Practical Office 2007 Chapter 10
Relational Databases.
CIS 155 Table Relationship
Access Lesson 2 Creating a Database
Presentation transcript:

1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database Relationships A one-to-many relationship A one-to-many relationship A one-to-one relationship A one-to-one relationship A many-to-many relationship A many-to-many relationship  About defining relationships Ms D. Anderson

2 What is a Primary Key?   The power of a relational database system such as Microsoft Access comes from its ability to quickly find and bring together information stored in separate tables using queries, forms, and reports. In order to do this, each table should include a field or set of fields that uniquely identifies each record stored in the table. This information is called the primary key of the table. Once you designate a primary key for a table, Access will prevent any duplicate or Null (empty) values from being entered in the primary key fields. Ms D. Anderson

3 AutoNumber primary keys   An AutoNumber field can be set to automatically enter a sequential number as each record is added to the table. Designating such a field as the primary key for a table is the simplest way to create a primary key. If you don't set a primary key before saving a newly created table, Microsoft Access will ask if you want it to create a primary key for you. If you answer Yes, Microsoft Access will create an AutoNumber primary key. Ms D. Anderson

4 Single-field primary keys   If you have a field that contains unique values such as ID numbers or part numbers, you can designate that field as the primary key. You can specify a primary key for a field that already contains data as long as that field does not contain duplicate values or Null values. Ms D. Anderson

5 Composite-field primary key  In situations where you can't guarantee the uniqueness of any single field, you may be able to designate two or more fields as the primary key. Composite Primary Key Ms D. Anderson

6 About Foreign Keys  A foreign key is a field in a relational table that matches the primary key column of another table. The foreign key can be used to cross-reference tables. The referenced table is called the parent table while the table with the foreign key is called the child table.  A foreign key is a field in a relational table that matches the primary key column of another table. The foreign key can be used to cross-reference tables. The referenced table is called the parent table while the table with the foreign key is called the child table. Primary Key – PK Primary Key – PK Foreign Key – FK Foreign Key – FK Ms D. Anderson

7 Database Relationships Ms D. Anderson

8 A one-to-many relationship   A one-to-many relationship is the most common type of relationship. In a one-to- many relationship, a record in Table A can have many matching records in Table B, but a record in Table B has only one matching record in Table A.   For example one supplier can supply more than one product to a company, but each product has only one supplier. Ms D. Anderson

9 The Supplier - Product Relationship PK FK Parent Table Child Table 1 ∞ Ms D. Anderson

10 A one-to-one relationship   In a one-to-one relationship, each record in Table A can have only one matching record in Table B, and each record in Table B can have only one matching record in Table A. This type of relationship is not common, because most information related in this way would be in one table. Ms D. Anderson

11 Student Names - Details relationship PK 11 Ms D. Anderson

12 A many-to-many relationship   In a many-to-many relationship, a record in Table A can have many matching records in Table B, and a record in Table B can have many matching records in Table A. This type of relationship is only possible by defining a third table (called a junction or join table) whose primary key consists of two fields — the foreign keys from both Tables A and B. A many-to-many relationship is really two one-to- many relationships with a third table. Ms D. Anderson

13 For example, the Orders table and the Products table have a many-to-many relationship that's defined by creating two one- to-many relationships to the Order Details table. One order can have many products, and each product can appear on many orders. Ms D. Anderson

14 Orders – Order Details – Products Relationship PK 1 1 ∞ ∞ Composite Primary Key FK Ms D. Anderson

15 About defining relationships   The kind of relationship that Microsoft Access creates depends on how the related fields are defined: A one-to-many relationship is created if only one of the related fields is a primary key or has a unique index. A one-to-many relationship is created if only one of the related fields is a primary key or has a unique index. A one-to-one relationship is created if both of the related fields are primary keys or have unique indexes. A one-to-one relationship is created if both of the related fields are primary keys or have unique indexes. A many-to-many relationship is really two one-to- many relationships with a third table whose primary key consists of two fields — the foreign keys from the two other tables. A many-to-many relationship is really two one-to- many relationships with a third table whose primary key consists of two fields — the foreign keys from the two other tables. Ms D. Anderson

16 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database Relationships A one-to-many relationship A one-to-many relationship A one-to-one relationship A one-to-one relationship A many-to-many relationship A many-to-many relationship  About defining relationships Ms D. Anderson