More on relational databases, including 1 to 1, 1 to many and many to many relationships Please use speaker notes for additional information!

Slides:



Advertisements
Similar presentations
More Diagramming & Practice with Relationship Modeling
Advertisements

Relational Database Example in Access - Order System Please use speaker notes for additional information!
Build a database I: Design tables for a new Access database
Relational database - student system As always please use speaker notes!
First Normal Form Second Normal Form Third Normal Form
Entity-Relationship Modeling (ER-M)
Order Entry System Please use speaker notes for additional information!
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Relational example using donor, donation and drive tables For additional information see the speaker notes!
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.
Dr. Chandra Amaravadi Western Illinois University INTRO TO ENTERPRISE DATABASES - II.
Microsoft Access Removing Redundancy in a Database.
Week 2 Normalization and Queries
Accounting Databases Chapter 2 The Crossroads of Accounting & IT
LSP 121 Week 2 Normalization and Queries. Normalization The Old Car Club database presented a problem – what if one person owns multiple cars? (One owner.
Relational example using donor, contrib and drive tables Please use speaker notes for additional information!
MIS2502: Data Analytics Relational Data Modeling
MS Access 2007 IT User Services - University of Delaware.
Database Relationships Objective 5.01 Understand database tables used in business.
SQL Use of Functions Character functions Please use speaker notes for additional information!
The Relational Database Model CST272. Return Creating the Unnormalized Table n List the fields n Select a primary key – The field (or concatenation of.
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 /
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 /
LSP 121 Week 2 Normalization and Advanced Queries.
1 Advanced Computer Programming Databases. Overview What is a database? Database Basics Database Components Data Models Normalization Database Design.
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)
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
Conceptual Data Modeling. What Is a Conceptual Data Model? A detailed model that shows the overall structure of organizational data A detailed model.
DATABASE DESIGN USING MICROSOFT ACCESS. What is a Database?  DMS Database management system  Database Collection of data organized in a manner that.
Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database.
Copyright Ó Oracle Corporation, All rights reserved. Normalization Use the student note section below for further explanation of the slide content.Use.
Database Normalization Lynne Weldon July 17, 2000.
Applicants Please use speaker notes for additional information!
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
XML and DTD Please you speaker notes for additional information!
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.
Constraints - primary and foreign keys in Oracle Please use speaker notes for additional information!
MS Access. Access is a DBMS/RDMS DBMS = Database Management System RDMS = Relational Database Management System.
HSC IT Center Training University of Florida Microsoft Access Understanding Relationships Health Science Center IT Center – Training
SQL and Conditions Speaker notes will provide additional information!
1 Introduction to Oracle Chapter 1. 2 Before Databases Information was kept in files: Each field describes one piece of information about student Fields.
Order Entry Program Please see speaker notes for additional information!
Quiz questions. 1 A data structure that is made up of fields and records? Table.
Introduction to Databases. What is a database?  A database program is nothing more than an electronic version of a 3x5 card file  A database is defined.
Supervisor Training On-Campus Student Employment.
Introduction to Access Chapter 13 pages 1-4. What is a database??? Related information is stored in databases  All SC student information is stored in.
Copyright Ó Oracle Corporation, All rights reserved. Assign Unique Identifiers A Unique Identifier (UID) is any combination of attributes and/or.
MIS2502: Data Analytics Relational Data Modeling
1 Class Agenda (04/06/2006 and 04/11/2006)  Discuss use of Visio for ERDs  Learn concepts and ERD notation for data generalization  Introduce concepts.
Relational Database in Access Student System As always please use speaker notes!
Database design Using Access 2007
ER & Relational: Digging Deeper R &G - Chapters 2 & 3.
MIS2502: Data Analytics Relational Data Modeling David Schuff
Howard Paul. Sequential Access Index Files and Data File Random Access.
Using a Database Access97 Please use speaker notes for additional information!
DATA SCIENCE MIS0855 | Spring 2016 Designing Data
Normalisation FORM RULES 1NF 2NF 3NF. What is normalisation of data? The process of Normalisation organises your database to: Reduce or minimise redundant.
1 Database Design Sections 6 & 7 First Normal Form (1NF), Second Normal Form (2NF), Unique Identifiers (UID), Third Normal Form (3NF), Arcs, Hierarchies.
Database Relationships
Databases Chapter 16.
MIS2502: Data Analytics Relational Data Modeling
Database Relationships
Database Fundamentals
Microsoft Applications
Looking at using multiple tables
Database Relationships
A relation is in first normal form if it does not contain repeating groups.
Presentation transcript:

More on relational databases, including 1 to 1, 1 to many and many to many relationships Please use speaker notes for additional information!

When designing a relational database you need to be aware of the relationships between the pieces of data and between the tables that you create. For example, in a relational database there are three possible relationships: 1 For example, if you keep name address information on one table and year end tax information on another table and each table has one record for each employee than the data is in a one to one relationship. 1 Many For example, if a donor has given multiple donations you have a one to many relationship. Each donor has given multiple donations but each donation was given by one and only one donor. Therefore there is one record for the donor on the donor table and multiple records for about the donations the donor has given on the donation table. Many For example, if you have a table of movies and a table of stars, you have a many to many relationship. One movie can have many stars and one star can be in many movies.

Employee table Employee ID (KEY) Employee Name Employee Address Employee Department Employee Medical Plan etc. 1 to 1 relationship Year end tax table Employee ID (KEY) Employee Gross Pay Employee Fed Taxes Employee State Taxes etc.

1 to many relationship Donor Table Donor ID # (KEY) Donor Name Donor City etc. Donation Table Donor ID# Drive # Date Contribution Amount (KEY) One donor can make multiple donations so there is a one to many relationship between the records in the donor table and the records in the donation table. 111John Doe Fall River … 222Ann Brown Taunton

1 to many relationship Inventory Table Item # (KEY) Item Name On Hand On Order Reorder Point Vendor # etc. Vendor Table Vendor # (KEY) Vendor Name Contact Name 1111…… … … … … …… Note that Vendor # is stored on the Inventory table because an Item can only have one Vendor. The Item # could not be stored in the Vendor Table because a Vendor can provide many items.

Many to many relationship Movie Table Move # (KEY) Movie Name etc. Star Table Star Id # (KEY) Star Name etc. Bridge Table Movie # Star ID # Salary (KEY) 111 … 222… … 2000… 3000… … … … … … …

Student relational database system We are going to design tables for a system to contain student information. Think of this as the type of information that would be needed for a transcript. We need: Information about the student: idno, name and address, major etc. Information about the courses the students have taken including grade Tables that will allow us to get the name of the major and the name of the course

Student relational database system STUDENT TABLE: Student Idno - this is the primary key since all information relates to it Name Address Phone Social Security # - this is a candidate key since it could be used as a primary key Major code Date enrolled Other information related directly to the student This table has information about the student. All of it must be dependent on the primary key. Clearly we need major information about the major as well, but that cannot be stored on the student table because the name of the major and the chair of the department directly relate to the major code, not to the student idno. Carrying them on the student table would break the rules of normalization. Therefore we need a major table. MAJOR TABLE: Major code - this is the primary key Major name Chair department

Student relational database system STUDENT COURSE TABLE: Student Idno Course code Primary key Semester course taken Grade Information about the courses the student has taken can not be kept on the STUDENT TABLE because they are a reoccurring group and thus break the rules of normalization. Essentially if we were to attempt to carry course information on the STUDENT TABLE we would have to determine how many slots we need (the maximum number of courses a student would be allowed to take). This is not practical and it definitely breaks the first normal form rule. The primary key has to be made up of more than one column/field because each student is allowed to take more than one course. The combination of student idno and course code and semester course was taken means that we will have a separate record for each time a course was taken by a student. The relation between student and student course table is a one to may relationship. One student can take many courses. COURSE TABLE: Course code - Primary key Course name Number credits We cannot keep the course name in the STUDENT COURSE TABLE because the course name directly relates to the course code. This breaks normalization rules. Practically speaking, we would not want to carry the course name in the STUDENT COURSE TABLE because if the course name changes we have to change it on any record. By carrying it on a separate COURSE TABLE, if the name changes we only have one place to enter that change.