1 n 1 n 1 1 n n Schema for part of a business application relational database.

Slides:



Advertisements
Similar presentations
Organisation Of Data (1) Database Theory
Advertisements

WHAT D IS RAW, UNPROCESSED FACTS AND FIGURES COLLECTED, STORED AND PROCESSED BY COMPUTERS.
ENTITY RELATIONSHIP MODELLING
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Accounting System Design
GCSE Computing#BristolMet Session Objectives# 21 MUST describe methods of validating data as it is input. SHOULD explain the use of key fields to connect.
Normalisation Ensuring data integrity in database design 1.
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.
Entity-Relationship Model and Diagrams (continued)
Database Design Chapter 3.
The Relational Database Model. 2 Objectives How relational database model takes a logical view of data Understand how the relational model’s basic components.
Chapter 3: Data Modeling
Implementing an REA Model in a Relational Database
Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 18-1.
Keys Chapter 8 Database Design for Mere Mortals. Why Keys Are Important They ensure that each record in a table can be properly identified. They help.
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
APPENDIX C DESIGNING DATABASES
MS Access 2007 IT User Services - University of Delaware.
Database Relationships Objective 5.01 Understand database tables used in business.
Practical tips for creating entity relationship diagrams (ERDs) Chitu Okoli Associate Professor in Business Technology Management John Molson School of.
3 The Relational Model MIS 304 Winter Class Objectives That the relational database model takes a logical view of data That the relational model’s.
1 DATABASE TECHNOLOGIES BUS Abdou Illia, Fall 2007 (Week 3, Tuesday 9/4/2007)
2.3 Organising Data for Effective Retrieval
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
COMM 226 Practical tips for creating entity relationship diagrams (ERDs) Chitu Okoli Associate Professor in Business Technology Management John Molson.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
24 GOLDEN COINS, 1 IS FAKE ( WEIGHS LESS). DATABASE CONCEPTS Ahmad, Mohammad J. CS 101.
1 California State University, Fullerton Chapter 7 Information System Data Management.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
Concepts and Terminology Introduction to Database.
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
In this chapter, you learn about the following: ❑ Anomalies ❑ Dependency and determinants ❑ Normalization ❑ A layman’s method of understanding normalization.
I Information Systems Technology Ross Malaga 4 "Part I Understanding Information Systems Technology" Copyright © 2005 Prentice Hall, Inc. 4-1 DATABASE.
Lecturer: Gareth Jones. How does a relational database organise data? What are the principles of a database management system? What are the principal.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T5: Designing Database Applications Business Driven Technology.
Implementing an REA Model in a Relational Database
M1G Introduction to Database Development 2. Creating a Database.
(Spring 2015) Instructor: Craig Duckett Lecture 10: Tuesday, May 12, 2015 Mere Mortals Chap. 7 Summary, Team Work Time 1.
Microsoft Access Intro Class 6 Relationships.
Implementing an REA Model in a Relational Database
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Database: Relational Vs Flat File. Databases - Structure Flat file database, contains only one table Relational database, contains more than one table.
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 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
Relational Database. I. Relational Database 1. Introduction 2. Database Models 3. Relational Database 4. Entity-Relationship Models 5. RDB Design Principles.
Lesson 2: Designing a Database and Creating Tables.
Flat Files Relational Databases
Data modeling Process. Copyright © CIST 2 Definition What is data modeling? –Identify the real world data that must be stored on the database –Design.
Sample Table Standard Notation Entity name in uppercase
Howard Paul. Sequential Access Index Files and Data File Random Access.
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 18-1.
Lesson 10 Databases.
Introducing Databases
Implementing an REA Model in a Relational Database
Databases Chapter 9 Asfia Rahman.
CHAPTER 7 DATABASE ACCESS THROUGH WEB
(Winter 2017) Instructor: Craig Duckett
Implementing an REA Model in a Relational Database
Tables and Their Characteristics
Implementing an REA Model in a Relational Database
Basic Concepts in Data Management
Relational Database Model
Databases.
Chapter 17 Designing Databases
Presentation transcript:

1 n 1 n 1 1 n n Schema for part of a business application relational database

Most of us are used to a Flat File database. This involves the use of One table (Access Jargon) only. A Flat file database is fine for very simple database functions but it turns out to be quite limiting. A flat file database’s worst limiting factor is that of data redundancy where data has to be typed into several different tables eg. Surname, Firstname into more than one table. Typo errors usually results when entering the same data into more than one table.

Foreign Key Primary Key To overcome redundancy, we use two or more tables. Two tables are linked by using a common field name in both tables. A Primary Key is field that UNIQUELY identifies that object within its table eg. Student ID or Customer ID. A Primary Key field cannot be empty or Null. A Foreign Key is a field of a table that is a primary key of another table. It is used to create a relationship between a pair of tables. A table CANNOT have two or more primary keys. When tables are linked we can access data from other tables either directly or indirectly.

Some advantages of a relational database include: Built in multilevel data accuracy (integrity): table level -> ensure records are not duplicated detects missing Primary key values ensures that a relationship between a pair of tables is valid uses validation techniques to ensure data entry is accurate Guaranteed data consistency and accuracy due to the various levels of checking for the accuracy & consistency of data Easy data retrieval: data can be retrieved from a particular table or from any number of related tables within a database. Improvements in software and hardware have allowed relational databases to run fast and smoothly. Eg. Access operates very poorly on workstations prior to the Pentium I chip with only 16 mb of RAM.

A connection between a pair of tables is known as a relationship. There are 3 types of relationships between tables and this has impact on how we design a database on paper before using the actual software. One-to-One (1:1) -> this occurs when only one record in a table relates only to one record in a second table. Eg: A primary class has only one teacher and that teacher is assigned only one class. Only 1 customer can purchase a new car and the sale of each new car is related to only one customer NOTE: read the tables left to right AND right to left

One-to-Many (1:n) -> this occurs when a single record in the first table can be related to one or more records in the second table, but a single record in the second table can be related to only one record in the first table. Eg: One student can take out many books from the library, but any one book can be taken out by one student at a time. This is by far the most common relationship that exists between a pair of tables within a database This relationship helps to remove duplicate data and to keep redundant data to an absolute minimum NOTE: read the tables left to right AND right to left

A many-to-many relationship exits between a pair of tables if a single record in the first table can be related to one or more records in the second table, and a single record in the second table can be related to one or more records in the first table. Eg: Each student studies many subjects, and each subject is studied by many students It is difficult to create a direct connection between many-to-many tables To overcome this, we make use of a linking table which consists of copying the primary key from each table involved.

1 1 n n Product ID Order ID n n n n The diagram on the right is a many-to-many relationship which results in redundant data. NOTE: read the tables left to right AND right to left To overcome this, a linking table is inserted by copying the Primary key from each table & adding more fields if desired. Linking Table Also can be referred to as a transaction table where the transaction number is unique Key: 1 = 1; n = many

One-to-One Relationship -> to create a relationship one takes a copy of the Primary key from the main table and inserts it into the 2nd table where it becomes a Foreign key. PK = Primary Key, FK = Foreign Key Managers Employee ID PK Address Mobile Phone Departments Department ID PK DeptName DeptCategory Maximum Staff Level 1 1 Managers Employee ID PK Address Mobile Phone Departments Department ID PK Employee ID FK DeptName DeptCategory Maximum Staff Level 1 1 There is one manager to department and only one department assigned to a manager. NOTE: read the tables left to right AND right to left

One-to-Many Relationship -> is similar to the one-to-one relationship. One copies the Primary key from the table on the “one” side of the relationship and inserts it into the table on the “many” side, where that field becomes the Foreign key. One Family may have more than one Student at school and Many students may belong to only One Family Family Family ID Street Suburb Postcode Phone Students Student ID Preferred Name Surname 1 n Family Family ID PK Street Suburb Postcode Phone Students Student ID PK Family ID FK Preferred Name Surname 1 n PK= Primary Key FK= Foreign Key

To create tables within a database, on paper one generally: Groups entities and attributes (fields) together in a way that makes sense Assigns a Primary key field to each group Establishes the type of relationship between groups Eg: 1:1, 1:n, n:n Assigns a Foreign key in 1:1 and 1:n relationships Creates a link between appropriate pairs of groups Once the paper design has been completed then one uses their favourite database software to create the respective tables and create the necessary linkages between tables. A many-to-many relationship requires a linking table. A one-to-one relationship may be directly connected A one-to-many relationship may be directly connected.

It represents a single subject, which can be an object or event. It has a Primary Key It does not contain multipart fields. Eg: Wollongong, NSW 2500 (text and number in 1 field) It does not contain multivalued fields. Eg: Johns, Andrew (more than one of the same type, text in this case) It does not contain calculated fields It does not contain unnecessary duplicate fields It contains only an absolute minimum amount of redundant (repeated) data

1 n 1 n 1 1 n n Schema for part of a business application relational database

Information Processes and Technology HSC Course, Powers, Heinemann ISBN X Designing Databases, Glyn / Dixon, McGraw Hill, ISBN: Database Design for Mere Mortals, Hernandez, Addison Wesley, ISBN Developing Databases in Access, Summers G, Nelson, ISBN: Illawarra Grammar School Steve Madsen