Download kroe_3ce_ch05a_extension

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

IMDb wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Part 2: Using Information Technology
Application Extension 5a
Database Design
Copyright © 2014 Pearson Canada Inc.
Copyright © 2014 Pearson Canada Inc.
5-1
Study Questions
1. Who will volunteer?
2. How are database application systems
3.
4.
5.
6.
developed?
What are the components of the entityrelationship data model?
How is a data model transformed into a
database design?
What is the user’s role?
Who will volunteer (continued)?
Copyright © 2014 Pearson Canada Inc.
5-2
Who Will Volunteer?
 Fundraising manager needs database to:
 Find volunteers
 Track volunteers



how many years
effectiveness
personal information
Copyright © 2014 Pearson Canada Inc.
5-3
How Are Database Application
Systems Developed?
 Database application system consists of:
 Database
 DBMS
 One or more database applications
 Database application consists of:
 Forms
 Reports
 Queries
 Application programs
Copyright © 2014 Pearson Canada Inc.
5-4
Database Development Process
Copyright © 2014 Pearson Canada Inc.
5-5
Database Application System
Development Process
 Developers interview users
 Develop requirements for new system
 Analyze existing reports, forms, and user activities
 Requirements summarized in data model
 Logical representation of structure of data
 Contains description of data and relationships
 Users validate and approve the data model
 Design implemented in a database
 Database filled with user data
Copyright © 2014 Pearson Canada Inc.
5-6
Database
 Must include all data necessary for users to
perform jobs
 Contains only that amount of data, and no
more
 Developers rely on users to:



Tell them what to include
Check data model
Verify correctness and completeness
Copyright © 2014 Pearson Canada Inc.
5-7
What Are the Components of the
Entity-Relationship Data Model?
 Techniques for creating data model
 Entity-relationship (E-R) data model
 Unified Modeling Language (UML)
 E-R data model components
 Entities (things) stored in the database
 Relationships among those entities
Copyright © 2014 Pearson Canada Inc.
5-8
Entities
 Some thing that users want to track

e.g., Order, Customer, Salesperson, and Item
 May be:

Physical object (e.g., Item or Salesperson)
 Logical construct or transaction (e.g., Order or Contract)
 Entity names are always singular
 Entities have:

Attributes
 describe characteristics of the entity
 Identifier
 attribute (or group of attributes) whose value is associated
with one and only one entity instance
Copyright © 2014 Pearson Canada Inc.
5-9
Student Data Model Entities
Copyright © 2014 Pearson Canada Inc.
5-10
Relationships
 Entities have relationships to each other
 1:1 relationship
 Single entity to single entity
 1:N relationship
 One-to-many
 Single entity to many entities
 N:M
 Many-to-many
Copyright © 2014 Pearson Canada Inc.
5-11
Example of Department, Adviser, and
Student Entities and Relationships
Copyright © 2014 Pearson Canada Inc.
5-12
E-R Diagrams
 Rectangles represent entities
 Relationships shown by lines
 Crow’s foot
 Forks at end of lines
 Indicate more than one relationship
 Read “many”
 Vertical line means at least one entity of that
type
 Small oval means entity is optional
Copyright © 2014 Pearson Canada Inc.
5-13
E-R Diagram Example
Copyright © 2014 Pearson Canada Inc.
5-14
Cardinality
 Number of entities that can be involved in
relationship

Maximum cardinality


maximum number involved
Minimum cardinality

constraints on minimum requirements
Copyright © 2014 Pearson Canada Inc.
5-15
How Is a Data Model Transformed into
a Database Design?
 Database design is the process of converting
a data model into tables, relationships, and
data constraints


Transforms entities into tables
Expresses relationships


defines foreign keys
Shows data constraints
Copyright © 2014 Pearson Canada Inc.
5-16
Normalization
 Normalization is the process of converting poorly
structured tables into two or more well-structured
tables
 Data integrity problems



Different names for the same entity
Produces incorrect and inconsistent information
Resolve by eliminating duplicated data
 Normalizing for Data Integrity
 Eliminate data duplication
 Slower to process
 Construct tables such that every table has single topic
Copyright © 2014 Pearson Canada Inc.
5-17
Representing Relationships
Copyright © 2014 Pearson Canada Inc.
5-18
Representing a 1:N Relationship
Copyright © 2014 Pearson Canada Inc.
5-19
Relational Database Design
 Designer creates table for every entity
 Entity identifier becomes primary key of table
 Attributes of entity become columns
 Tables normalized to single theme
 Represent relationships between tables
 Add foreign key to one or more tables
Copyright © 2014 Pearson Canada Inc.
5-20
What Is the User’s Role?
 Final judges as to what data should contain
 Determine how records are related to each
other
 Need to review data model
 Must insure that model reflects an accurate
view of business
Copyright © 2014 Pearson Canada Inc.
5-21
Who Will Volunteer? (continued)
 Consultant creates data model
 Based on interviews with users
 Data model reviewed and approved
 Database tables constructed
 Primary and foreign keys selected

based on interviews
 Microsoft Access database created
 Relationships indicated
 Forms and reports constructed
Copyright © 2014 Pearson Canada Inc.
5-22
Data Model for Volunteer Database
Copyright © 2014 Pearson Canada Inc.
5-23
Active Review
1. Who will volunteer?

Summarize the problem that the fundraising manager must solve.
Explain how a database can help solve this problem. Describe the
missing information. In your own words, what data must be available to
construct the missing information?
2. How are database application systems developed?

Name and briefly describe the components of a database application
system. Explain the difference between a database application system
and a database application program. Using Figure CE5a-1 as a guide,
describe the major steps in the process of developing a database
application system. Explain what role is crucial for users and why that
role is so important.
3. What are the components of the entity-relationship data
model?

Define the terms entity, attributes, and relationship. Give an example of
two entities (other than those in this book) that have a 1:N relationship.
Give an example of two entities that have an N:M relationship. Explain
the difference between maximum and minimum cardinality. Show two
entities having a 1:N relationship in which one is required and one is
optional.
Copyright © 2014 Pearson Canada Inc.
5-24
Active Review
How is a data model transformed into a database
design?
4.

Give an example of a data integrity problem. Describe, in general
terms, the process of normalization Explain how normalizing data
prevents data integrity problems. Explain the disadvantage of
normalized data. Using your examples from Question 3, show how 1:N
relationships are expressed in relational database designs. Show how
N:M relationships are expressed in relational database designs.
What is the user’s role?
5.

Describe the major role for users in the development of a database
application system. Explain what is required to change a 1:N
relationship to an N:M relationship during the data modelling stage.
Explain what is required to make that same change after the database
application system has been constructed. Describe how this
knowledge impacts your behaviour when a database application
system is being constructed for your use.
Copyright © 2014 Pearson Canada Inc.
5-25
Active Review
6. Who will volunteer? (continued)

Examine Figure CE5a-12. Describe the maximum and minimum
cardinality for each relationship. Justify these cardinalities. Change the
relationship between Prospect and Phone to N:M, and explain what
this means. Change the relationship between Prospect and Work to
1:1, and explain what this means. Explain how each relationship is
represented in the design in Figure CE5a-14. Show examples of both
primary keys and foreign keys in this figure. In Contact, determine
whether EmployeeName is part of a primary key or part of a foreign
key. Explain what problem the consultant foresaw in the use of the
Name attribute. Explain how that problem was avoided. The consultant
added an attribute to the data model that was not part of the users’
world. Explain why that attribute will not add unnecessary complication
to the users’ work experiences.
Copyright © 2014 Pearson Canada Inc.
5-26