DBS201: Relational Databases. Agenda Entity Relationship Model Discovering Attributes Identifying Keys Defining Relationships Relational Model.

Slides:



Advertisements
Similar presentations
The Relational Model J.G. Zheng May 15 th Introduction Edgar F. Codd, 1970 One sentence to explain relational database model: Data are organized.
Advertisements

The Relational Database Model – some relations you might want to avoid!!!
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Entity Relationship (ER) Modeling
ISMT221 Information Systems Analysis and Design Entity-Relationship Diagram Lab 4 Tony Tam.
Data Modeling with ERD ISYS 363. Entity-Relationship Diagram An entity is a “thing” in the real world, such as a person, place, event for which we intend.
Database Systems: Design, Implementation, & Management, 5 th Edition, Rob & Coronel 1 Data Models: Degrees of Data Abstraction l Modified ANSI/SPARC Framework.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
APPENDIX C DESIGNING DATABASES
Data Modeling 1 Yong Choi School of Business CSUB.
Yong Choi School of Business CSUB
Entity Relationship Model Chapter 6. Basic Elements of E-R Model Entity Object of the real world that stores data. Eg. Customer, State, Project, Supplier,
The Relational Database Model
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.
DBS201: Entity Relationship Diagram
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Entity Relationship Diagrams (ERDs)
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
Chapter 5 Entity Relationship (ER) Modelling
Conceptual Data Modeling, Entity Relationship Diagrams
Mapping from Data Model (ERD) to Relational Model
Database Design Principles – Lecture 3
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T5 DESIGNING DATABASE APPLICATIONS.
The Relational Database Model
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T5: Designing Database Applications Business Driven Technology.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 2: Modeling Data in the Organization.
CS370 Spring 2007 CS 370 Database Systems Lecture 4 Introduction to Database Design.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
Database Design – Lecture 3 Conceptual Database Design.
Database Design – Lecture 5 Conceptual Data Modeling – adding attributes.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
1 Database & DBMS The data that goes into transaction processing systems (TPS), also goes to a database to be stored and processed later by decision support.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
Data modeling using the entity-relationship model Chapter 3 Objectives How entities, tuples, attributes and relationships among entities are represented.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
Database Design – Lecture 4 Conceptual Data Modeling.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Database Design – Lecture 6 Moving to a Logical Model.
Entity-Relation Model. E-R Model The Entity-Relationship (ER) model was originally proposed by Peter in 1976 ER model is a conceptual data model that.
Data Modeling Yong Choi School of Business CSUB. Part # 2 2 Study Objectives Understand concepts of data modeling and its purpose Learn how relationships.
Lesson 4: The Relational Model. Lesson Overview Database Design Entities Relationships E-R Diagrams.
INTRODUCTION TO DATA MODELING CS 260 Database Systems.
Database Design – Lecture 7
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Connecting (relating) Data Tables to get Custom Records (Queries) Database Basics.
Tutorial 2 Data Modelling. 3 Terminology & Notation(1) An entity is an object about which the system needs to hold information –Customer, Student, Course.
Database Design Slide 1 Database Design Lecture 7 part 2 Mapping ERD to Tables.
Database Design. Database Design Process Data Model Requirements Application 1 Database Requirements Application 2 Requirements Application 4 Requirements.
Howard Paul. Sequential Access Index Files and Data File Random Access.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
DATA SCIENCE MIS0855 | Spring 2016 Designing Data
ENTITY – RELATIONSHIP MODEL Melissa Ann D. Callejo Chairmane Abanilla.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
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.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Standards and Conventions
Entity-Relationship Model
Tables and Their Characteristics
Database Design – Lecture 4
Database Systems: Design, Implementation, and Management Tenth Edition
Presentation transcript:

DBS201: Relational Databases

Agenda Entity Relationship Model Discovering Attributes Identifying Keys Defining Relationships Relational Model

Entity Relationship Diagram Shows entities – similar to a table structure An entity is an object that exists and is distinguishable from other objects An entity is represented by a set of attributes An attribute has a domain (i.e. a set of permitted values) Entities are associated by relationships

Agenda Entity Relationship Model Discovering Attributes Identifying Keys Defining Relationships Relational Model

Attributes Attributes are characteristics of Entities. They describe an entity Different types of attributes: Simple Composite Single-Valued Multi-Valued Attributes have a Domain

Attributes Simple An attribute that can not be divided i.e. FIRST_NAME

Attributes Composite Attributes that can be further subdivided to yield additional attributes i.e. NAME can be subdivided into FIRST_NAME, INITIAL, and LAST_NAME

Attributes Single-Valued An attribute that can have only a single value Not necessarily a simple attribute i.e. Customer Number, Part Number

Attributes Multi-Valued An attribute that can have many values i.e. Education Two possible ways to deal with these: Create attributes for each value Create a new entity composed of the original multi-valued attributes components Second approach is preferred

Remember requirements gathering approaches? Different approaches: bottom-up/top-down Top-down uses an overview/narrative of a system to discover entities Bottom-up uses screen/report samples to discover attributes, then these are grouped into entities Discovering Attributes

Top-down Interview client Look for description of entities (i.e. their characteristics in a narrative) Bottom-up Use fields on screen/report samples Discovering Attributes

From this example: 1. A composer writes/creates many compositions. 2. The composer includes the name, country, year of birth, year of death and era (e.g. classical, baroque, romantic, or modern). 3. The composition includes a title, type of composition (symphony, concerto, instrumental, chamber, opera, or choral) Discovering Attributes attributes Attributes – because these describe the entity

Discovering Attributes The composer includes the name, country, year of birth, year of death and era (e.g. classical, baroque, romantic, or modern). The composition includes a title, type of composition (symphony, concerto, instrumental, chamber, opera, or choral) No reference to era; assuming it is another entity No to composition type; assuming it is another entity

Potential Attributes: Team Title Player Name, Address, DateOfBirth, Phone Number Sponsor Name, Address, Phone Number, Fax Coaches Name, Address, Phone Number District Name, Description Discovering Attributes

From this example: Multiple Real Estate Listing Service (MRELS) is a company that has offices throughout Southern Ontario. These offices have a number of Real Estate agents working for them. MRELS deals in both residential and commercial real estate. Agents work with customers to get a listing or to find a listing for a customer. A listing will include the address and the type of property (residential or commercial), square footage, annual taxes and closing date. If it is a residential property, it will include number of bedrooms, number of bathrooms, special features (central air, heated by gas or oil, radiators or forced air, for instance). For a commercial property, it will include number of offices as well as number of docking bays (where trucks back up to be loaded/unloaded). Discovering Attributes Some attributes described – We will have to assume what some of the attributes might be

Discovering Attributes Potential multi-valued attribute; therefore create a new entity

Discovering Attributes

Agenda Entity Relationship Model Discovering Attributes Identifying Keys Defining Relationships Relational Model

A key is used to identify and locate the information contained in a particular record A key consists of one or more attributes that determine other attributes A multi-attribute key is called a composite key Two types of keys we will address: Primary Key and Foreign Key Identifying Keys Identified from original list of attributes Identified through relationships

Identifying Keys Primary Key Uniquely identifies any given entity If an entity does not contain an attribute that would be a good Primary Key candidate, then need to create a new attribute to be the Primary Key Course code could uniquely identify this entity and therefore is a candidate to be a primary key None of these attributes could uniquely identify a composer; therefore, need to create a new entity

Identifying Keys What should be the Primary Key for the following examples?

Identifying Keys Foreign Key Created automatically through relationships between entities An attribute whose value matches the primary key value in the related table

Agenda Entity Relationship Model Discovering Attributes Identifying Keys Defining Relationships Relational Model

Defining Relationships 1:1 Determine most obvious path (i.e. which entity is the true ‘1’). Take the PK from that true ‘1’ and make it an FK in the other ‘1’ 1:M Take the PK from the 1 and make it an FK in the M M:N Create a bridge table and take the PKs from each original table and make the PKs and FKs of the bridge table

Agenda Entity Relationship Model Discovering Attributes Identifying Keys Defining Relationships Relational Model

Entities translate into tables Attributes translate into fields Table is made up of columns (fields) and rows (records)

Relational Model CompositionIDTitleComposerID 111Rhapsody in BlueG18 222Second RhapsodyG18 333Academic Festival OvertureB Tragic OvertureB Ein deutsches RequiemB113 ComposerIDNameCountryYearOfBirthYearOfDeath B33Johann Sebastian BachGermany B76Ludwig van BeethovenGermany B90Irving BerlinAmerica B113Johannes BrahmsGermany G18George GershwinAmerica G80Orlando GibbonsEngland Primary keys are obvious – they uniquely identify a row. Foreign keys are obvious – they refer to a field in another table.

Relational Model FIGURE P3.23 Table name: TRUCK Database name: Ch03_TransCo Table name: BASE Table name: TYPE 1.What are the Primary Keys for each table? 2.What are the Foreign Keys for each table? 3.Draw the ERD