CIT 381 ER Basics - relationship types - foreign keys - ER Studio.

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

Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Mapping an ERD to a Relational Database To map an ERD to a relational database, five rules are defined to govern how tables are constructed. 1)Rule for.
CIT 381 Slides part 3. Review: One-to-many and many-to-one One movie is stored on many videos – many videos are in one store. Both relationships are mandatory.
Concepts of Database Management Sixth Edition
Databases Revision.
CIT 381 ER Modeling Difficulties - categories - generalization - three-way relationships.
CIT 381 More ER Modeling - review one-to-many - one-to-one - recursive relationships.
Modeling Data The Entity Relationship Model (ER) For Database Design.
Entity-Relationship Model and Diagrams (continued)
Methodology Logical Database Design for the Relational Model
CIT 381 introduction to relations. Tables movieIdtitlegenrelengthrating 101The Thirty- Nine Steps mystery101R 123Annie Hallromantic comedy 110R 145Lady.
Motivation for IDEF1X Simplicity Common Standard Useful when relational model is target Air Force 1985 or thereabouts.
Mapping from E-R Model to Relational Model Yong Choi School of Business CSUB.
Information Resources Management January 30, 2001.
Database Design Chapter 2. Goal of all Information Systems  To add value –Reduce costs –Increase sales or revenue –Provide a competitive advantage.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Concepts of Database Management Seventh Edition
APPENDIX C DESIGNING DATABASES
Entity Relationships. Relationships Relationships exist between entities The type of relationship is entirely dependent on the business rules The business.
 An entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationships between entities in a database.  An Entity Relationship.
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
Data Modeling and the Entity-Relationship Model Chapter Four DAVID M. KROENKE’S DATABASE CONCEPTS, 2 nd Edition.
DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 1.
the Entity-Relationship Model
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
ICOM 5016 – Introduction to Database Systems Lecture 4 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Mapping from Data Model (ERD) to Relational Model Yong Choi School of Business CSUB.
Converting ER model Into Relational Table
Relational DB Components
Conceptual Design Lecture - 2 Database Development.
Conversion from ER diagram to relational model
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
The REA Model. The REA model provides structure for developing an accounting database It helps to identify It helps to The REA Model.
Principles of Database Design, Part II AIMS 2710 R. Nakatsu.
DATABASEMODELSDATABASEMODELS  A database model ◦ defines the logical design of data. ◦ Describes the relationships between different parts of data.
Mapping from Data Model (ERD) to Relational Model
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
Avoiding Database Anomalies
WEEK 10 Database Design. Agenda – Week 10 Review Hybrid Review Table Instance Charts Primary Keys Normalization.
Chapter 3: Relational Model  Structure of Relational Databases  Normal forms (chap. 7)  Reduction of an E-R Schema to Relational (Sect. 2.9)  Relational.
Implementing an REA Model in a Relational Database
Concepts of Database Management Sixth Edition Chapter 6 Database Design 2: Design Method.
Data Modeling IST210 Class Lecture.
1 Entity-Relationship Diagram. 2 Components of ERD: –Entity –Relationship –Cardinality –Attributes.
CS 370 Database Systems Lecture 9 The Relational model.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
An Entity Relationship (ER) Diagram is a graphic that shows the interrelationship between entities in a database.
Description and exemplification of entity-relationship modelling.
Jozef Kuper.  Describe a Database  Entities  Atributes  Relationships.
ICOM 5016 – Introduction to Database Systems Lecture 9 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Relational Theory and Design
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-03 Introduction –Data Models Lectured by, Jesmin Akhter.
Database Systems – ER Diagrams EXAMPLE COMPANY DATABASE Requirements of the Company (oversimplified to illustrate) The company is organized into DEPARTMENTs.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
IST 220 – Intro to DB Lecture 4 Database Design thru ER Modeling.
Conversion from ER diagram to relational model 1 ER is a visual model The relational model is a matemathical model.
Teanna Clarke 6aQ What is a Entity-Relationship Diagram?  An Entity-Relationship Diagram (ERD) is a tool that graphically shows the connections among.
Data Modeling AND ER MODELS.
Microsoft Access CS 110 Fall Entity Relationship Model Entities Entities Principal data object about which information is to be collectedPrincipal.
ENTITY RELATIONSHIP DIAGRAM. Objectives Define terms related to entity relationship modeling, including entity, entity instances, attribute, relationship.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Presentation transcript:

CIT 381 ER Basics - relationship types - foreign keys - ER Studio

Entities A concrete item we wish to represent in our database. Examples: books, cars, employees, wombats, accounts, offices. Completely described by its attributes.

Relationship An association between two or more entities. Orders is a relationship between entities Customers and Books. Assign is a relationship between Cars and Employees.

First Step: Design Entities What are the important objects that we want to keep information for? Example: cars, employees, customers,… For each of these objects, write down all of the attributes we will need to keep. Example: cars - licenseNum, vin, make, model, year, odometerRead

Example Entities car_license_num car_vin car_make car_model car_year car_color emp_ssn emp_fname emp_lname emp_address emp_city emp_state emp_zip emp_home_phone primary keys carsemployees The primary key is the chosen identifier. At this stage, all other attributes belong solely to that entity. (Foreign keys come later.)

Next Step: Relationships Cars are assigned to employees (or vice versa) assign is a relationship between cars and employees car_license_num car_vin car_make car_model car_year car_color emp_ssn emp_fname emp_lname emp_address emp_city emp_state emp_zip emp_home_phone carsemployees assign

Relationship Cardinality Relationships can be one-to-many (1:N) many-to-one (N:1) many-to-many (N:M) one-to-one (1:1) Important to know the cardinality of each relationship as it affects the table design.

One-to-many Suppose each car can be assigned to more than one employee, but each employee has exactly one car. one car to … many employees (dot = “many”)

One-to-many (optional) Same as previous, but an employee does not have to have a car – each employee has zero or one cars. The open diamond indicates an optional relationship: an employee does not have to have a car. This means that the car_license_num field in employees can be NULL (that is, blank).

Many-to-one All cars are assigned to one employee. An employee can have more than one car. many cars to … one employee

Many-to-Many A car can be assigned to many employees. An employee can be assigned to many cars. ER Studio calls this a non-specific mandatory relationship.

Resolving many-to-many A M:N relationship needs to be represented by its own table, sometimes called a bridging table. Notice the solid lines and curved corners. It is a weak entity.

Weak entities A weak entity is one that does not have enough information in its attributes to form a key (unique identifier). Consider a bank check: check number 3512 does not identify it (unless we know the account number). Note that account number is an attribute of account, not of check.

Weak entity example (1) custID identifies customer, accountNum identifies account, checkNum only partially identifies check

Weak entity example (2) We added a mandatory one-to- many relationship, as before.

Weak entity example (3) We insert an identifying relationship:  solid line  makes foreign key (accountNum) part of the primary key of check  curved corners on check indicate it is a weak entity

Another weak entity From the company database, handed out in class.