Entity-Relationship - Faculty Personal Web Page

Download Report

Transcript Entity-Relationship - Faculty Personal Web Page

Systems Analysis & Design
Chapter 7
Conceptual Data Modeling
Representation of organizational data
Purpose is to show rules about the meaning and
interrelationships among data
Entity-Relationship (E-R) diagrams are commonly used to
show how data are organized
Main goal of conceptual data modeling is to create accurate
E-R diagrams
Methods such as interviewing, questionnaires and JAD are
used to collect information
Consistency must be maintained between process flow,
decision logic and data modeling descriptions
Process of Conceptual Data Modeling
● First step is to develop a data model for the system
being replaced
● Next, a new conceptual data model is built that
includes all the requirements of the new system
● Project repository links all design and data modeling
steps performed during SDLC
Deliverables and Outcome
● Primary deliverable is the entity-relationship diagram
● There may be as many as 4 E-R diagrams produced
and analyzed during conceptual data modeling
– Covers just data needed in the project’s application
– E-R diagram for system being replaced
– An E-R diagram for the whole database from which the
new application’s data are extracted
– An E-R diagram for the whole database from which data for
the application system being replaced is drawn
Sample conceptual data model diagram
Deliverables and Outcome
● Second deliverable is a set of entries about data
objects to be stored in repository or project
– Repository links data, process and logic models of an
information system
– Data elements that are included in the DFD must appear
in the data model and visa versa
– Each data store in a process model must relate to
business objects represented in the data model
Data Design Concepts
● Data Structures
– A file or table contains data about people,
places, things, or events that interact with the
– File-oriented system
– File processing system
– Database system
Data Design Concepts
● Overview of File Processing
– Potential problems
• Data redundancy
• Data integrity
• Rigid data structure
Data Design Concepts
● Overview of File Processing
– Uses various types of files
Master file
Table file
Transaction file
Work file – scratch file
Security file
History file
Data Design Concepts
● Overview of Database Systems
– A properly designed database system offers a
solution to the problems of file processing
– Provides an overall framework that avoids data
redundancy and supports a real-time, dynamic
– Database management system (DBMS)
– The main advantage of a DBMS is that it offers
timely, interactive, and flexible data access
Data Design Concepts
● Overview of Database Systems
– Advantages
Better support for client/server systems
Economy of scale
Flexible data sharing
Enterprise-wide application – database administrator
• Stronger standards
Data Design Concepts
● Overview of Database Systems
– Advantages
Controlled redundancy
Better security
Increased programmer productivity
Data independence
Data Design Concepts
● Database Tradeoffs
– Because DBMSs are powerful, they require
more expensive hardware, software, and data
networks capable of supporting a multi-user
– More complex than a file processing system
– Procedures for security, backup, and recovery
are more complicated and critical
DBMS Components
● Interfaces for Users, Database
Administrators, and Related Systems
– Users
• Query language
• Query by example (QBE)
• SQL (structured query language)
– Database Administrators
• A DBA is responsible for DBMS management and
DBMS Components
● Interfaces for Users, Database
Administrators, and Related Systems
– Related information systems
• A DBMS can support several related information
systems that provide input to, and require specific data
from, the DBMS
 ODBC – open database connectivity
 JDBC – Java database connectivity
DBMS Components
● Data Manipulation Language
– A data manipulation language (DML) controls
database operations, including storing,
retrieving, updating, and deleting data
● Schema
– The complete definition of a database, including
descriptions of all fields, tables, and
relationships, is called a schema
DBMS Components
● Physical Data Repository
– The data dictionary is transformed into a
physical data repository, which also contains the
schema and subschemas
– The physical repository might be centralized, or
distributed at several locations
Web-Based Database Design
● Characteristics of Web-Based Design
– In a Web-based design, the Internet serves
as the front end, or interface, for the database
management system
– Web-based systems are popular because
they offer ease of access, cost-effectiveness,
and worldwide connectivity
Web-Based Database Design
● Data Security
– Web-based data must be totally secure, yet
easily accessible to authorized users
– To achieve this goal, well-designed systems
provide security at three levels: the database
itself, the Web server, and the
telecommunication links that connect the
components of the system
Data Design Terminology
● Definitions
– Entity
– Table or file
– Field
• Attribute
• Common field
– Record
• Tuple
Data Design Terminology
● Key Fields
– Primary key
• Combination key
 Composite key
 Concatenated key
 Multi-valued key
– Candidate key
• Nonkey field
– Foreign key
– Secondary key
Data Design Terminology
● Referential Integrity
– Validity checks can help avoid data input errors
Entity-Relationship Diagrams
● An entity is a person, place, thing, or
event for which data is collected and
● Provides an overall view of the system,
and a blueprint for creating the physical
data structures
● Entity-relationship diagram
Introduction to Entity-Relationship
(E-R) Modeling
● Notation uses three main constructs
– Data entities
– Relationships
– Attributes
● Entity-Relationship (E-R) Diagram
– A detailed, logical representation of the entities,
associations and data elements for an
organization or businessxxxxxxxx
Entity-Relationship (E-R) Modeling
Key Terms
● Entity
– A person, place, object, event or concept in the user
environment about which the organization wishes to
maintain data
– Represented by a rectangle in E-R diagrams
● Entity Type
– A collection of entities that share common properties or
● Attribute
– A named property or characteristic of an entity that is of
interest to an organization
Entity-Relationship (E-R) Modeling
Key Terms
● Candidate keys and identifiers
– Each entity type must have an attribute or set of
attributes that distinguishes one instance from
other instances of the same type
– Candidate key
• Attribute (or combination of attributes) that uniquely
identifies each instance of an entity type
Entity-Relationship (E-R) Modeling
Key Terms
A candidate key that has been selected as the unique
identifying characteristic for an entity type
Selection rules for an identifier
1. Choose a candidate key that will not change its value
2. Choose a candidate key that will never be null
3. Consider substituting single value surrogate keys for large
composite keys
Entity-Relationship (E-R) Modeling
Key Terms
● Relationship
– An association between the instances of one or
more entity types that is of interest to the
– Association indicates that an event has occurred
or that there is a natural link between entity
– Relationships are always labeled with verb
Conceptual Data Modeling and the ER Diagram
● Goal
– Capture as much of the meaning of the data as possible
– A better design that is easier to maintain
Degree of Relationship
● Degree
– Number of entity types that participate in a relationship
● Three cases
– Unary
• A relationship between two instances of one entity type
– Binary
• A relationship between the instances of two entity types
– Ternary
• A simultaneous relationship among the instances of three
entity types
• Not the same as three binary relationships
Example relationships of different degrees
● The number of instances of entity B that can
be associated with each instance of entity A
● Minimum Cardinality
– The minimum number of instances of entity B that may
be associated with each instance of entity A
● Maximum Cardinality
– The maximum number of instances of entity B that may
be associated with each instance of entity A
Naming and Defining Relationships
● Relationship name is a verb phrase
● Avoid vague names
● Guidelines for defining relationships
– Definition explains what action is being taken and why it is
– Give examples to clarify the action
– Optional participation should be explained
– Explain reasons for any explicit maximum cardinality
Naming and Defining Relationships
● Guidelines for defining relationships
– Explain any restrictions on participation in the
– Explain extent of the history that is kept in the
– Explain whether an entity instance involved in a
relationship instance can transfer participation to
another relationship instancexxxxxxxxx
Entity-Relationship Diagrams
● Drawing an ERD
– The first step is to list
the entities that you
identified during the
fact-finding process
and to consider the
nature of the
relationships that link
● Table design
● Involves four stages: unnormalized
design, first normal form, second normal
form, and third normal form
● Most business-related databases must
be designed in third normal form
● Standard Notation Format
– Designing tables is easier if you use a
standard notation format to show a table’s
structure, fields, and primary key
Example: NAME (FIELD 1, FIELD 2, FIELD 3)
● Repeating Groups and Unnormalized
– Repeating group
• Often occur in manual documents prepared by users
– Unnormalized design
● First Normal Form
– A table is in first normal form (1NF) if it does not
contain a repeating group
– To convert, you must expand the table’s primary
key to include the primary key of the repeating
● Second Normal Form
– To understand second normal form (2NF), you
must understand the concept of functional
– Functionally dependent
● Second Normal Form
A standard process exists for converting a
table from 1NF to 2NF
1. Create and name a separate table for each field in
the existing primary key
2. Create a new table for each possible combination of
the original primary key fields
3. Study the three tables and place each field with its
appropriate primary key
● Second Normal Form
– Four kinds of problems are found with 1NF
designs that do not exist in 2NF
• Consider the work necessary to change a particular
product’s description
• 1NF tables can contain inconsistent data
• Adding a new product is a problem
• Deleting a product is a problem
● Third Normal Form
– 3NF design avoids redundancy and data
integrity problems that still can exist in 2NF
– A table design is in third normal form (3NF) if it is
in 2NF and if no nonkey field is dependent on
another nonkey field
– To convert the table to 3NF, you must remove all
fields from the 2NF table that depend on another
nonkey field and place them in a new table that
uses the nonkey field as a primary key
● A Normalization
– To show the
normalization process,
consider the familiar
situation, which depicts
several entities in a
school advising system:
Using Codes During Data Design
● Overview of Codes
– Because codes often are used to represent
data, you encounter them constantly in your
everyday life
– They save storage space and costs, reduce
transmission time, and decrease data entry time
– Can reduce data input errors
Using Codes During Data Design
● Types of Codes
1. Sequence codes
2. Block sequence codes
3. Alphabetic codes
a. Category codes
b. Abbreviation codes – mnemonic codes
Significant digit codes
Derivation codes
Cipher codes
Action codes
Using Codes During Data Design
● Developing a Code
Keep codes concise
Allow for expansion
Keep codes stable
Make codes unique
Use sortable codes
Avoid confusing codes
Make codes meaningful
Use a code for a single purpose
Keep codes consistent
Steps in Database Design
1. Create the initial ERD
2. Assign all data elements to entities
3. Create 3NF designs for all tables, taking
care to identify all primary, secondary,
and foreign keys
4. Verify all data dictionary entries
5. After creating your final ERD and
normalized table designs, you can
transform them into a database
Database Models
● Relational Databases
– The relational model was introduced during the
1970s and became popular because it was
flexible and powerful
– Because all the tables are linked, a user can
request data that meets specific conditions
– New entities and attributes can be added at any
time without restructuring the entire database
Database Models
● Object-Oriented Databases
– Many systems developers are using objectoriented database (OODB) design as a natural
extension of the object-oriented analysis process
• Object Data standard
• Object Database Management Group (ODMG)
• Each object has a unique object identifier
Data Storage and Access
● Data storage and access involve strategic
business tools
● Strategic tools for data storage and access
– Data warehouse - dimensions
Data Storage and Access
● Strategic tools for data storage and
– Data Mining
Increase average pages viewed per session
Increase number of referred customers
Reduce clicks to close
Increase checkouts per visit
Increase average profit per checkout
Data Storage and Access
● Logical and Physical Storage
– Logical storage
• Characters
• Data element or data item
• Logical record
– Physical storage
• Physical record or block
• Buffer
• Blocking factor
Data Storage and Access
● Data Storage Formats
Binary digits
Data Storage and Access
● Data Storage Formats
– Binary
Binary storage format
Integer format
Long integer format
Other binary formats exist for efficient storage of
exceedingly long numbers
Data Storage and Access
● Selecting a Data Storage Format
– In many cases, a user can select a specific
data storage format
– For example, when using Microsoft Office,
you can store documents, spreadsheets, and
databases in Unicode-compatible form by
using the font called Arial Unicode MS
– Best answer is it depends on the situation
Data Storage and Access
● Date Fields
– Most date formats now are based on the
model established by the International
Organization for Standardization (ISO)
– Can be sorted easily and used in
– Absolute date
– Best method depends on how the specific
date will be printed, displayed, or used in a
Data Control
● File and database control must include
all measures necessary to ensure that
data storage is correct, complete, and
● A well-designed DBMS must provide
built-in control and security features,
including subschemas, passwords,
encryption, audit trail files, and backup
and recovery procedures to maintain
Data Control
User ID
Recovery procedures
Audit log files
Audit fields