 R EVIEW L AB 5 ERD’ S DBS201. H OW DO YOU GET TO THIS SCREEN IN SQL?

Slides:



Advertisements
Similar presentations
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Advertisements

ENTITY RELATIONSHIP MODELLING
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Accounting System Design
Systems Development Life Cycle
Modeling the Data: Conceptual and Logical Data Modeling
Entity-Relation Modeling Hun Myoung Park, Ph.D., Public Management and Policy Analysis Program Graduate School of International Relations International.
Agenda for Week 1/31 & 2/2 Learn about database design
The Relational Database Model:
Data Modeling Entity - Relationship Models. Models Used to represent unstructured problems A model is a representation of reality Logical models  show.
Chapter 3: Modeling Data in the Organization
Database Design Chapter 2. Goal of all Information Systems  To add value –Reduce costs –Increase sales or revenue –Provide a competitive advantage.
Lesson-19 Data Modeling and Analysis
FIS 431/631 Financial Information Systems: Analysis and Design ERD & Normalization Joe Callaghan Oakland University Department of Accounting & Finance.
APPENDIX C DESIGNING DATABASES
Trisha Cummings.  Most people involved in application development follow some kind of methodology.  A methodology is a prescribed set of processes through.
Entity Relationship Modeling Objectives: To illustrate how relationships between entities are defined and refined. To know how relationships are incorporated.
ระบบฐานข้อมูลขั้นสูง (Advanced Database Systems) Lecturer AJ. Suwan Janin Phone:
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Concepts and Terminology Introduction to Database.
Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Rob and Coronel Adapted for INFS-3200.
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.
Databases. Not All Tables Are Created Equal Spreadsheets use tables to store data and formulas associated with that data The “meaning” of data is implicit.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
M1G Introduction to Database Development 2. Creating a Database.
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.
Relational Database. Database Management System (DBMS)
1 Entity-Relationship Diagram. 2 Components of ERD: –Entity –Relationship –Cardinality –Attributes.
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
Next Back A-1 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights.
C-1 Management Information Systems for the Information Age Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Extended Learning Module.
 R EVIEW M ORE ON ERD’ S DBS201. Why ERDs What is an ERD What is represented by boxes What is the connection between boxes called.
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling.
IMS 4212: Introduction to Data Modeling—Relationships 1 Dr. Lawrence West, Management Dept., University of Central Florida Relationships—Topics.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Relational Theory and Design
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Data Modeling Yong Choi School of Business CSUB. Part # 2 2 Study Objectives Understand concepts of data modeling and its purpose Learn how relationships.
1 DATABASE TECHNOLOGIES (Part 2) BUS Abdou Illia, Fall 2015 (September 9, 2015)
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
Lecture 91 Introduction to Data Analysis and Logic Specification Objectives l Draw an entity-relationship diagram, and explain the types of entity relationships.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
6.1 © 2007 by Prentice Hall Chapter 6 (Laudon & Laudon) Foundations of Business Intelligence: Databases and Information Management.
EntityRelationshipDiagrams. Entity Relationship Models The E-R (entity-relationship) data model views the real world as a set of basic objects (entities)
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
2 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Data Models Why data models are important About the basic data-modeling.
1 Information System Analysis Topic-3. 2 Entity Relationship Diagram \ Definition An entity-relationship (ER) diagram is a specialized graphic that illustrates.
McGraw-Hill/Irwin Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Modeling the Data: Conceptual and Logical Data Modeling.
Data Modeling AND ER MODELS.
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
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.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
© 2014 by McGraw-Hill Education. This is proprietary material solely for authorized instructor use. Not authorized for sale or distribution in any manner.
© The McGraw-Hill Companies, All Rights Reserved APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
DESIGNING DATABASE APPLICATIONS
Tables and Their Characteristics
ERD’s REVIEW DBS201.
Entity Relationship Diagrams ERDs
Presentation transcript:

 R EVIEW L AB 5 ERD’ S DBS201

H OW DO YOU GET TO THIS SCREEN IN SQL?

The following statements are run Set schema PRMIERC40 Select * From Customer Select * from Salesrep Select * from Cust_Rep

F RANK S OLTIS IS A C USTOMER WITH SALESREP 99

S ALES R EP 99 IS R USSELL P ANGBORN

W HERE ARE F RANK S OLTIS AND R USS P ANGBORN

create View PRMIERC40.CUST_REP as ( SELECT C.CUSTOMER_NUMBER, TRIM(C.FIRST_NAME) || ' ' || C.LAST_NAME AS CUST_NAME, TRIM(S.FIRST_NAME) || ' ' || S.LAST_NAME AS REP_NAME FROM PREMIERE.CUSTOMER C, PREMIERE.SALESREP S WHEREC.SALES_REP_NUMBER = S.SALES_REP_NUMBER ) Anything wrong?

Duplicate key value specified. INSERT INTO PRMIERC40.CUSTOMER (SELECT * FROM PREMIERE.CUSTOMER)

SELECT CUSTOMER_NUMBER, LAST_NAME, FIRST_NAME, STREET, CITY, STATE, BALANCE, SALES_REP_NUMBER FROM PREMIERE.CUSTOMER

What command is being used? DSPFD PRMIERC40/CUSTOMER *CST

LAB 5

E NTITY R ELATIONSHIP D IAGRAMS ERD S DBS201

Why ERDs Documentation used to represent the database in an abstract way The data model can be reviewed by the end user and the person responsible for the physical database design Useful tool for the person creating the data model.

What is an ERD This conceptual data model represents the data used in an organization and the relationships between the data It is a graphical representation of the proposed database

Entities and Events Entities - People, places, things or concepts about which information must be recorded Entities as Events – Placing an order or approving a loan Attributes for entities, events and relationships would be things like customer names or dates on which orders were placed Attribute – one single valued fact about an entity that we may want to record

E (Relationship)Ds Relationships are found between entities An employee is in a department A department has many employees Business rules must be taken into account Every employee must be in a single department

E (Relationship)Ds Relationships are found between entities and events A customer (entity) places an order (event) A loan officer (entity) approves a loan (event) Business rules must be taken into account Loan example - a rule that the borrower must have an adjusted gross income of at least half of his or her outstanding debt may be enforced

An ERD should capture all required information make sure data appears only once in the database design not include in the data model any data that is derived from other data that is already in the data model arrange data in the data model in a logical manner

Equivalent Terms: Relational Model Table-Oriented DBMS Conventional File Systems Conceptionally Represents RelationTableFileEntity Type TupleRowRecordEntity Instance AttributeColumnFieldProperty DomainColumn TypeData TypeAllowable Values ElementColumn ValueField ValueProperty Value

Customer Customer Relation Customer Table Customer File Customer Entity

Last Name Last name attribute in Customer Relation Last name column in Customer Table Last name field in Customer File Last name property of Customer Entity

Phone Number Customer Relation phone number domain is numeric or character Customer Table phone number column type is numeric or character Customer File phone number data type is numeric or character Customer Entity phone number allowable values are numeric or character

Phone Number is Customer Relation phone number element is or (416) Customer Table phone number column value is or (416) Customer Table phone number field value is or (416) Customer Table phone number property value is or (416) A numeric field can used an edit code to get the special characters included “() – ”

Last Name, First Name, Phone Smith, Bill, as a tuple in the Customer Relation Smith, Bill, as a row in the Customer Table Smith, Bill, as a record in the Customer File Smith, Bill, as an entity instance of the Customer Entity

Steps in Designing an ERD Create Entities by identifying the people, places or events about which the end user wants to store data Define Attributes by determining the attributes that are essential to the system under development. For each attribute, match it with exactly one entity that it describes

Steps in Designing an ERD Select Unique Identifier Identify the data attribute(s) that uniquely identify one and only one occurrence of each entity. Eliminate many to many relationships, and include a unique identifier (UID) and foreign keys in each entity Define Relationships Find the natural associations between pairs of entities using a relationship matrix. Arrange entities in rectangles and join those entities with a line

Steps in Designing an ERD Determine Optionality and Cardinality Determine the number of occurrences of one entity for a single occurrence of the related entity. Name Relationships Name each relationship between entities Eliminate Many-toMany Relationships Many-to-many relationships cannot be implemented into database tables because each row will need an indefinite number of attributes to maintain the many- to-many relationship. Many-to-many relationships must be converted to one-to-many relationships using associative entities Determine Data Types Identify the data types and sizes of each attribute

Case Study Each employee may be assigned to one and only one department. Some employees may not be assigned to any department. The employee data is stored in the employee entity. Each department could have many employees assigned to it. Some departments nay not have any employees assigned to them. The department data is stored in the department entity. Each employee may have one and only one job title. Under certain circumstances, some employees may not be assigned a job title.

Case Study Each job title may be assigned to many employees. Some job titles may not be assigned to any employees. The job data is stored in the job entity. Each employee may be assigned to many projects. Sometimes an employee may be off work and is not assigned to any projects. Each project must be assigned to at least one employee. Some projects may have several employees assigned to them. The project data is stored in the project entity

Identify Entities Employee Department Job Project

Identify Attributes Employee – employee_id, first_name, last_name, soc_ins_no, hire_date Volatile attributes Required and Optional Attributes Time dependant attributes Domains

Select Unique Identifier (UID) Every entity must have unique identifying attribute(s) called a unique identifier This is a single attribute or a collection of attributes that uniquely identifies one and only one instance of an entity. When two or more attributes are used as the unique identifier it is called a concatenated key

Candidate Key Sometimes there are several attributes that could be the unique identifier For an EMPLOYEE entity we could use employee_id, social_ins_no, _address or telephone_no These are all called candidate keys

Candidate Keys Must: be unique for each instance within an entity never be missing, incomplete or NULL for an instance use no attributes other than those necessary to uniquely identify an instance of an entity

A Unique Identifier: should be meaningless other than as an identifier should never change should not have a limited number of values available only one (UID) should be specified for each table

For EMPLOYEE Soc_ins_no is not meaningless – do you want people knowing your personal number in the company? A telephone number may change The best choice is an arbitrarily generated employee number assigned when the employee is hired

Determining relationships DEPARTMENT EMPLOYEE A relationship is like a verb that shows some dependency or natural association between two entities A department contains employees An employee is assigned to a department

Determining optionality and cardinality TABLE A TABLE B Each instance of Table B is related to a maximum of one and a minimum of one instance of Table A

Each instance of Table A is related to zero, one or more instances of Table B TABLE A TABLE B

An employee must be in one and only one department PK employee_id first_name last_name soc_sec_no hire_date job_id FK1department_code PKdepartment_code department_name manager_id DEPARTMENT EMPLOYEE

A department may have zero, one or many employees PK employee_id first_name last_name soc_sec_no hire_date job_id FK1department_code PKdepartment_code department_name manager_id DEPARTMENT EMPLOYEE

An employee may be in zero or one department PK employee_id first_name last_name soc_sec_no hire_date job_id FK1department_code PKdepartment_code department_name manager_id DEPARTMENT EMPLOYEE

Different notations are used to represent the cardinality of relationships 1:1 1:M M:N Which one was shown with more detail in the previous examples?

No information on optionality is given with this 1:M example PK employee_id first_name last_name soc_sec_no hire_date job_id FK1department_code PKdepartment_code department_name manager_id DEPARTMENT EMPLOYEE M 1

Summary Entity or Event Relationship Optionality Cardinality Attributes UID ERD Diagrams