Download presentation
Presentation is loading. Please wait.
Published byCoral Lee Modified over 9 years ago
1
Database Design HIMA 4160 Fall 2009
2
House Keeping Assignment 4 due tonight Assignment 5 due next Monday.
3
Agenda Database Concepts Entity Relational Diagram (ERD)
4
Database == Data + Base Transaction Storage
5
Database: Definition A collection of data that: is organized usually computer-based represents repetitive information implicitly primarily for transaction supports retrieval
6
Is paper medical record a database? Yes No No opinion
7
Is Excel a database system? Yes No No Opinion
8
The shortcomings of a large table Patient_IDPatient_Name … Doctor_IDDoctor_Name… 1Patient B…1Doctor A… 2Patient C…1Doctor A… 3Patient D…1Doctor A… 4Patient E…2Doctor B… 5Patient F…2Doctor B… 6Patient G…2Doctor B… 7Patient H…2Doctor B… 8Patient I…2Doctor B…
9
A more relational database Patient IDPatient 1Patient A 2Patient B 3Patient C 4Patient D Doctor IDDoctor 1Doctor A 2Doctor B 3Doctor C 4Doctor D Patient IDDoctor ID 12 13 21 41 33 14
10
Database Management System (DBMS) A computer program for the purposes of managing databases. Is the basis for many applications (e.g., Electronic Health Records, Personal Health Records). A DBMS can host many databases A database can be implemented in many different DBMS systems.
11
Data Modeling Before you implement a database, you need to design the database Data modeling is a systematic way to help you design the database. Map/simplify the real world to database schema/structure.
12
Data Modeling
13
Why Data Modeling? Power and flexibility of database depend on data model Database is the realization of data model Evaluation of commercial products Communicating with vendors and IT staff Building your own databases
14
Database Analysis Determine User Requirements Develop Data Models “A conceptual data model is one that represents data from the viewpoint of the user, independent of any technology that will be used to implement the model.” A database has two parts Schema Data
15
Stages of Data Modeling Conceptual Model E-R diagram Logical Model Relational Model Physical Model Database management
16
Database Modeling Real World E-R Diagram Relational Model DBMS ConceptualLogicalPhysical
17
Introduction Entity Relationship Modelling (ERM) A technique used to analyze & model the data in organizations Using diagram to represent entities and relationship of components in a system. Supported by modern DBMS system. De facto tool for database design
18
The Importance of Data Modeling Characteristics captured during data modeling crucial in design of databases, programs, other items facts and rules essential in assuring data integrity Data are the most complex aspects of the modern organization Data are determined by the business rules. Need to avoid scope creeps Data tend to be more stable than the business processes that use the data
20
Definitions Entity an aggregation of a number of data elements each data element is an attribute of the entity Relationship an association between two or more entities that is of particular interest
21
Background Introduced by Peter Chen in ’75 “The Entity-Relationship Model – Toward a Unified View of Data”, ACM Transactions on Database Systems, Vol. 1, No. 1, March 1976, Pages 9 - 36 now widely used in commercial database.
22
Why use ER Diagrams ? provides a global quick reference to an organization’s data structures. can be used individually to design an Information System’s (IS) data structure. offers a basis of consequential database design and development.
23
ERD Development Process Identify the entities Determine the attributes for each entity Select the identifier for each entity Establish the relationships between the entities Draw an entity model Test the relationships and the keys
24
Entities Person, place, object, event, or concept … in the user environment about which the organization wishes to maintain data Entity type collection of entities that share common properties or characteristics CAPITAL LETTERS Entity instance single occurrence of an entity type ENTITY
25
A Simple Example STUDENTs attend COURSEs that consist of many SUBJECTs. A single SUBJECT (i.e. English) can be studied in many different COURSEs. Each STUDENT may only attend one COURSE.
26
Identify the entities Any physical object, event, or abstract concept that we can record facts about. Rule of thumbs: a. Look for nouns b. Not all nouns are entities c. Some of them are attributes
27
Identify Entities A football team has coaches, players, trainers and other assistants. Coach’s roles include head coach, defense and offence coordinators, quarterback coaches, etc. Football players can play different positions like quarterback, running backs, receivers etc. Rule of thumbs: a. Look for nouns b. Not all nouns are entities c. Some of them are attributes
28
Identify Entities (my answers) Coach Player Trainer Assistants Roles Positions
29
Attributes Property or characteristic of an entity type that is of interest to the organization initial capital letter followed by lowercase letters underscore instead of space (first_name) Simple or Composite? composite has component parts will users need to refer to those individual components? Single-valued or Multivalued? Stored or Derived? PLAYER NameNumber
30
Determine the Attributes Every Entity has attributes. Attributes are characteristics that allow us to classify/describe an entity e.g., entity STUDENT has the attributes: student number name date of birth course number
31
Identifier [Attribute] “An identifier is an attribute (or combination of attributes) that uniquely identifies individual instances of an entity type.” atomic or composite Criteria will not change its value never null unique PLAYER NameNumber SS#
32
Key Attributes Certain attributes identify particular facts within an entity, these are known as KEY attributes. The different types of KEY attribute are: Primary Key Composite Primary Key Foreign Key
33
Key Definitions Primary Key: One attribute whose value can uniquely identify a complete record (one row of data) within an entity. Composite Primary Key A primary key that consists of two or more attribute within an entity. Foreign Key A copy of a primary key that exists in another entity for the purpose of forming a relationship between the entities involved.
34
ER Diagram Notations Every entity diagram consists of the following components: COURSE COURSE Entity (labelled box) Relationship line
35
Degrees of a Relationship MAN MAN WOMAN WOMAN CUSTOMER CUSTOMER ORDER ORDER COURSE COURSE SUBJECT SUBJECT One-to-one (1:1) One-to-many (1:n) Many-to-many (n:m) NOTE: Every many to many relationship consists of two one to many relationships working in opposite directions 1M 1 1 MM
36
MAN MAN WOMAN WOMAN CUSTOMER CUSTOMER ORDER ORDER Course Course Subject Subject One-to-one (1:1) One-to-many (1:n) Many-to-many (n:m) Notation of Cordiality (Degree of relationship)
37
A person can own no or several cars. A car doesn’t have to be owned by a person, but if it is, it is owned by only one person. Notation for Optional Participation CAR PERSON optional relationship 1 M 1
38
A Sample Four Entities ER Diagram A Student Record Entity Diagram PROFESSORS STUDENTS COURSES SUBJECTS
39
Exercise One patient can see several doctors. One doctors can see many patients. A patient may not see a doctor at all
40
Exercise A nurse is assigned to manage an exam room.
41
Exercise A patient must have a insurance and a insurance company can have many patients as their customer.
42
Exercise (complex one) Draw an E-R diagram to represent the data schema of a physician office. The entities included are physicians, patients, insurance companies, lab, medications etc.
43
ER Diagram Summary Identify the entities Determine the attributes for each entity Select the primary key for each entity Establish the relationships between the entities Draw an entity model
44
Logic Design and Physical Design
45
Conceptual Design BEDPATIENTS
46
Conceptual Design DOCTORSPATIENTS
47
DOCTORSPATIENTS
48
Conceptual Design DOCTORSPATIENTS
49
Conceptual Design DOCTORS 1.Doctor_ID 2.Doctor_lname 3.Doctor_fname 4.Doctor_mi 5.Doctor_specialty 6.Doctor_address 7.Doctor_phone 8.Doctor_email PATIENTS 1.Patient_ID 2.Patient_lname 3.Patient_fname 4.Patient_mi 5.Patient_address 6.Patient_phone 7.Patient_email
50
Logical Model Entities tables Relationship keys (primary and foreign) Many to many two one to many relationship with an associate entity in the middle Normalization
51
Conceptual Model DOCTORS 1.Doctor_ID 2.Doctor_lname 3.Doctor_fname 4.Doctor_mi 5.Doctor_specialty 6.Doctor_address 7.Doctor_phone 8.Doctor_email PATIENTS 1.Patient_ID 2.Patient_lname 3.Patient_fname 4.Patient_mi 5.Patient_address 6.Patient_phone 7.Patient_email
52
Logical Model DOCTORS 1.Doctor_ID 2.Doctor_lname 3.Doctor_fname 4.Doctor_mi 5.Doctor_specialty 6.Doctor_address 7.Doctor_phone 8.Doctor_email PATIENTS 1.Patient_ID 2.Patient_lname 3.Patient_fname 4.Patient_mi 5.Patient_address 6.Patient_phone 7.Patient_email 8.Doctor_ID
53
Conceptual Model DOCTORS 1.Doctor_ID 2.Doctor_lname 3.Doctor_fname 4.Doctor_mi 5.Doctor_specialty 6.Doctor_address 7.Doctor_phone 8.Doctor_email PATIENTS 1.Patient_ID 2.Patient_lname 3.Patient_fname 4.Patient_mi 5.Patient_address 6.Patient_phone 7.Patient_email
54
Associate Entity/Bridge Table DOCTORS 1.Doctor_ID 2.Doctor_lname 3.Doctor_fname 4.Doctor_mi 5.Doctor_specialty 6.Doctor_address 7.Doctor_phone 8.Doctor_email PATIENTS 1.Patient_ID 2.Patient_lname 3.Patient_fname 4.Patient_mi 5.Patient_address 6.Patient_phone 7.Patient_email D_P 1.Patient_ID 2.Doctor_ID
55
Physical Model Doctor_I D Doctor_ln ame Doctor_fa nme Doctor_m i Doctor_sp ecialty Doctor_a ddress Doctor_p hone Doctor_e mail 1………………… 2………………… 3………………… Patient_I D Patient_ln ame Patient_fn ame Patient_M I Patient_a ddress Patient_p hone Patient_e mail 001……………… 002……………… 003……………… Patient_IDDoctor_ID 0011 2 0021 0032 RelationTable TupleRow AttributeColumn
56
Summary on Data Modeling Data model is the most critical aspect of system design and function Data models should reflect real world objects and their relationships to ensure durability A correct data model outlasts applications, including many not anticipated at system start-up
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.