Relationships Relational Database. Identifying Entities… In the previous tutorial you learnt about identifying entities in a flat file database. Also.

Slides:



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

Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2.1: Relational Databases.
© Paradigm Publishing, Inc Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 2Creating Relationships between Tables.
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
Microsoft Office 2013 ®® Access Tutorial 2 Building a Database and Defining Table Relationships.
Database Modeling IT Key Ideas, Dynamic Database Systems, 2002 Chapter 8.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
COMPREHENSIVE Access Tutorial 2 Building a Database and Defining Table Relationships.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
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.
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.
Database Relationships Objective 5.01 Understand database tables used in business.
N. J. Taylor Database Management Systems (DBMS) 1.
Relational Database Need to Knows. What is a database? Data - is just a pile of numbers or stats. A business "organises" the data to be meaningful and.
Using MIS 4e Chapter 5 Database Processing
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
Access Lesson 2 Creating a Database
Copyright © 2008 Pearson Prentice Hall. All rights reserved.1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
Access Tutorial 2 Building a Database and Defining Table Relationships
DAY 14: ACCESS CHAPTER 1 Tazin Afrin October 03,
Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
McGraw-Hill/Irwin ©2009 The McGraw-Hill Companies, All Rights Reserved Business Driven Information Systems 2e Plug-In T6: Basic Skills and Tools Using.
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.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
® Microsoft Access 2010 Tutorial 2 Building a Database and Defining Table Relationships.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
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.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Creating Related Tables Creating Related Tables Determining.
Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
McGraw-Hill/Irwin © The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T6 Basic Skills Using Access.
1 CSE 2337 Introduction to Data Management Access Book – Ch 1.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
3. Relational Model Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1.
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.
Database Design Normalisation. Last Session Looked at: –What databases were –Where they are used –How they are used.
OBJECTIVES  Understand relational databases  Explore a database  Create a database  Create a table  Create primary keys  Relate two tables  Enter.
U:/msu/course/cse/103 Day 18, Slide 1 CSE 103 Day 18 If you are not enrolled in CSE 103, please save and log out by 10:10.
Lesson 2: Designing a Database and Creating Tables.
Referential Integrity
Exploring Office Grauer and Barber 1 One-to-Many Relationships: Subforms and Multiple-Table Queries(Wk7)
Work with Tables and Database Records Lesson 3. NAVIGATING AMONG RECORDS Access users who prefer using the keyboard to navigate records can press keys.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
Database Relationships Objective 5.01 Understand database tables used in business.
Access Module Implementing a Database with Microsoft Access A Great Module on Your CD.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall. 1 Skills for Success with Microsoft ® Office 2007 PowerPoint Lecture to Accompany.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
Access Tutorial 2 Building a Database and Defining Table Relationships
New Perspectives on Microsoft Access 2016
Databases Chapter 9 Asfia Rahman.
and Defining Table Relationships
Database Management Systems (DBMS)
Database Relationships
Access Tutorial 2 Building a Database and Defining Table Relationships
Lingma Acheson Department of Computer and Information Science IUPUI
Access Tutorial 2 Building a Database and Defining Table Relationships
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

Relationships Relational Database

Identifying Entities… In the previous tutorial you learnt about identifying entities in a flat file database. Also its limitations and why a relational database is better avoids data redundancy and anomalies/orphaned data. In this tutorial, you will create a basic relational database. e.g. two tables in Microsoft Access that are joined by a relationship.

Tables Looking at our example flat file spreadsheet that has two tables/entities one about the Sales Rep, the other about Jobs, create a new blank Access database on your H drive. Save it as tutorial Create a Sales Rep table with the appropriate fields and data types to hold the first set of 3 sales rep and their details.

Tables Create a Jobs table with the appropriate fields and data types to hold the second set of information. Add Brent working on two projects, one for McDonalds, the other for KFC, one took him 19 hours, the other 22 for a date last week.

Primary Keys When you need to track multiple tables, a relational DB is best. Need some way to uniquely identify each employee and each of the jobs. These are known as a Primary key i.e.could have same employee name, so need a unique way to identify each record e.g. student ID, jobID, empID

Primary Keys In your database, add another column to each table to reflect these unique IDs. These should be data type autonumber and need to be the Primary key for that table. When you refer to a particular employee for a job, they can now be known by their empID, instead of their name e.g. according to this job table, what were Carlas total hours worked?

Foreign Keys Tables that are related need to have fields in common. E.g. the job table will have an EmpID field in it. Though the field label doesnt have to match, these fields must have data that matches i.e. the same data type and data. The field in one table – Primary Key, will match or relate to a field in another table – Foreign Key. In this example, the Primary Key is yellow and the Foreign key it relates to is red. NOTE – if your primary key is autonumber, its foreign key must be data type Number to create a relationship.

Entity Relationship Diagrams - ERDs To depict tables/entities and their relationships, you draw whats called an ERD. Below is an example using the DVD example from tutorial 1. MoviesStudios

Entity Relationship Diagrams - ERDs This shows a studio can have M or Many movies made, but a movie can only be made at 1 studio. There are other relationship types but for your assessment, this is the only one to worry about. MoviesStudios

Draw an ERD for your assessment club/tables you created in tutorial 1, and where the 1 to M relationships will flow. Ask yourself what entity can have more than one entry? Or what entity can only have a single entry? E.g. a customer can have many orders, but an order must only have one customer.

Relationships in Access Under Database Tools in Access, Add both tables and create a 1 to M relationship between the Primary key in Sales Rep to the Foreign key in Jobs. Tip - you should drag from the M to the 1 or the foreign key to the primary key. Tip – close tables before trying to create the relationship.

Relationships in Access NOTE – Every relationship should always have Enforce Referential integrity ticked. This gives a database two advantages: 1. It makes sure a primary and foreign key match e.g. we could not assign a jobID to empID J, because this does not exist in the Sales Rep table. 2. You wont be able to delete a Sales Rep if they have Jobs in the other table. i.e no orphans.

Assessment Task If Miss has signed off on your Entities and Fields template and your ERD, have a go at creating your tables for your assessment database, assigning the correct data types, and then establish the relationships. DO NOT input data until Miss has signed off on the structure of your DB.