DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 2.

Slides:



Advertisements
Similar presentations
Convert ER to Relational Database Entity relation Entity relation Attributes attributes Attributes attributes Primary key primary key Primary key primary.
Advertisements

The Relational Database Model – some relations you might want to avoid!!!
Monash University Week 7 Data Modelling Relational Database Theory IMS1907 Database Systems.
Oakland University School of Business Administration
Relational Model Stores data as tables –Each column contains values about the same attribute –Each column has a distinct name –Each row contains values.
Entity-Relationship Model and Diagrams (continued)
The Relational Database Model:
Mapping of N:M Relationships PERSON-ID TITLE PERSON-NAME DATE-OF-BIRTH PERSON-ID PROJECT-ID HOURS-SPENT PROJECT-ID END-DATE START-DATE E-R Diagram PERSON.
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
Database – Part 2a Dr. V.T. Raja Oregon State University.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Database Architecture The Relational Database Model.
Chapter 3 Relational Model Chapter 4 in Textbook.
The Relational Database Model
© Pearson Education Limited, Chapter 2 The Relational Model Transparencies.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 5 Advanced Data Modeling.
Database Management System Lecture 6 The Relational Database Model – Keys, Integrity Rules.
DATA MODELING AND DATABASE DESIGN
RAJIKA TANDON DATABASES CSE 781 – Database Management Systems Instructor: Dr. A. Goel.
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
Database Design Sections 6 & 7 Second Normal Form (2NF), Unique Identifiers (UID), Third Normal Form (3NF), Arcs, Hierarchies and Recursive relationships.
Concepts and Terminology Introduction to Database.
Fundamentals of Relational Database Yong Choi School of Business CSUB, Bakersfield.
CTFS Workshop Shameema Esufali Suzanne Lao Data coordinators and technical resources for the network
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Copyright Ó Oracle Corporation, All rights reserved. Normalization Use the student note section below for further explanation of the slide content.Use.
10/17/2012ISC471/HCI571 Isabelle Bichindaritz 1 Technologies Databases.
Relational Database. Database Management System (DBMS)
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
ITN Table Normalization1 ITN 170 MySQL Database Programming Lecture 3 :Database Analysis and Design (III) Normalization.
Database Design Sections 11 Database relationship, Integrity, keys, mapping conceptual model to logical/physical model Previous Section 12 – DDLesson11Fa12.ppt.
Database Design – Lecture 8
Database Systems, 9th Edition 1.  In this chapter, students will learn: That the relational database model offers a logical view of data About the relational.
Database Design Sections 11 & 12 drawing conventions, generic model, integrity, keys, mapping conceptual model to logical/physical model.
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor:
Relational Theory and Design
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
CTFS Workshop Shameema Esufali Asian data coordinator and technical resource for the network
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
Understand Relational Database Management Systems Software Development Fundamentals LESSON 6.1.
Logical Database Design and the Relational Model.
Database Design Slide 1 Database Design Lecture 7 part 2 Mapping ERD to Tables.
Including Constraints. What Are Constraints? Constraints enforce rules at the table level. You can use constraints to do the following: – Enforce rules.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Chapter 3: Relational Databases
Howard Paul. Sequential Access Index Files and Data File Random Access.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
Microsoft Access 2010 Chapter 11 Database Design.
Mapping ER to Relational Model Each strong entity set becomes a table. Each weak entity set also becomes a table by adding primary key of owner entity.
Lecture 4: Logical Database Design and the Relational Model 1.
8-1 Creating Tables. 8-2 Creating Tables: Syntax CREATE TABLE table (column datatype[column_constraint], column datatype[column_constraint], column datatype[column_constraint],...
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
1 Database Design Sections 6 & 7 First Normal Form (1NF), Second Normal Form (2NF), Unique Identifiers (UID), Third Normal Form (3NF), Arcs, Hierarchies.
Database Constraints Ashima Wadhwa.
Entity-Relationship Model
CIS 207 The Relational Database Model
Introduction to MS Access: creating tables, keys, and relationships
Generalization.
Entity-Relationship Model and Diagrams (continued)
Chapter 3 The Relational Database Model
Normalization Referential Integrity
Database Management System
Constraints.
Database Design: Relational Model
Mapping an ERD to a Relational Database
INSTRUCTOR: MRS T.G. ZHOU
RELATIONAL DATA MODEL - 1
Presentation transcript:

DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 2

Objectives Resolving ERD with LINK entities Recursive relationships Levels of normalization Integrity constraints Candidate keys, primary and foreign keys

Resolving Many to Many Relationships Most many to many relationships must be resolved before they can be mapped to a database design. We resolve that by creating new entity called LINK or INTERSECTION ENTITY. CREATE an INTERSECTION ENTITY to control this relationship EMPLOYEE_ NEW_FORCE ACTIVITY performs an requires an

RESOLVED ERD EMPLOYEE_ NEW_FORCE ACTIVITY EMPLOYEE -ACTIVITY * per_diem_rate # emp_no * position o job_description * salary o commission # activity_id * description o start_date o end_date * internal requires an for performs an performed by

Recursive Relationships Define a relationship between an entity and itself as a recursive relationship. Represent that relationship with a “pig’s ear.” EMPLOYEE #* id *last name ofirst name * salary *start date o manager_id managed by managed by the manager of the manager of

Level First normal form Second normal form Third normal form Characteristics All attributes must be single-valued. An attribute must depend upon its entity's entire UID (not only on part of UID) No non-UID attribute may be dependent upon another non-UID attribute. Levels of Normalization Benefits Minimizes data redundancy Reduces integrity problems Identifies missing entities and relationships

Unnormalized Form # emp_no * position * salary o commission o activity1 o act1_start_date o act1_end_date o activity2 o act2_start_date o act2_end_date o activity3 o act3_start_date o act3_end_date EMPLOYEE

First Normal Form EMPLOYEE # emp_no * position * salary o commission ACTIVITY # activity_id * description o start_date o end_date

Convert to third Normal Form EMPLOYEE # id * last name * department location DEPARTMENT # id * name has employed in

Third Normal Form EMPLOYEE # id * last name DEPARTMENT # id * name * location has employed in

Integrity Constraints Ensure data consistency Should be enforced by the database server or the application software Correspond to keys –Primary key, unique key and foreign key TypeEntityReferentialColumnUser-DefinedCharacteristics No part of a primary key can be NULL, and the value must be unique. Foreign key values must match a primary key or be NULL. Values in the column must match the defined datatype. Values must comply with business rules.

Defining a Primary Key A primary key (PK) allows no duplicate values and cannot be NULL. Each row is uniquely identified by a column or set of columns (composite primary key). There may be only one PK, but there may be many candidate keys. Emp_no activity_id per_diem_rate Composite Primary Key Table EMPLOYEE_ACTIVITY

Defining a Foreign Key A foreign key (FK) is a column in one table that refers to a PK in the same table or in another table. The value must either match the PK value in the ‘parent table’ or be NULL. If FK is part of a PK, then it cannot be NULL.

Defining a Foreign Key: Example The DEPT_ID column is an FK in the EMP table, and refers to values in the ID column of the DEPT table. IDLAST_NAMEFIRST_NAME...DEPT_ID... 1MartinezAna10 2KimToni31 3TakeshiTofiro21 4McCoyJames10 5GauletChantal20 IDNAMEREGION_ID 10Corporate1 20HR1 21Sales1 31Stock1 Primary Key Foreign Key EMP Table DEPT Table Primary Key