Chapter 5 - Organizing Data and Information

advertisement
Why is there a demand for more and
better data?
• Competitive environment
• powerful workstations that can handle data
quickly
• More computer literate personnel
Files and Databases
• Data Resource Management
– a managerial activity that applies information
systems technology and management tools to
manage the company’s data resources
DBA
Equivalents
DBMS
Office
Database
File Cabinet
File
File Drawer
Record
File Folder
Record
Attributes
Report
Example of a Data Elements
• Database Administrator: responsible for the
development and management of the organization’s
database
• DBAs work with programmers and system’s analysts
to design and implement the database
• DBAs also work with users and managers of the firm
to establish policies for managing an organization’s
database
©2012 Francisco Delgadillo©
1
Hierarchy of Data
•
•
•
•
•
•
Flat File
• A table storing all database information in one
large two-dimensional table
Database
Files
Records
Attributes
Characters
Bits
Hierarchy of Data
Database
Integrated collection of logically related data elements
Personnel File, Payroll File, Department File
Data Management Approaches
• Traditional Approach
• Database Approach
File (eg. personnel file)
–
–
–
–
098-40-1370 Ponder, Liza 1-20-2010
594-39-3948 Kohn,Tyler3-24-2009
234-34-3483 Bullick, Staci 2-02-2009
457-74-3854 Fry, Courtney 1-23-2009
Hierarchy of Data
• Record (Record containing SSN, Last and First
name, Hire date)
– 594-41-3955 Meeks, Alyssa 4-24-2007
Traditional
File
Processing
• Attribute (first name)
– Alyssa
• Characters (bytes)
– 01000001 (Letter “A” in ASCII)
• Bits
– 0 or 1
©2012 Francisco Delgadillo©
2
Traditional Approach
• data are stored, organized and processed in
independent files of data records
• Problems:
– data duplication
– lack of integration
– data dependence
Database Management Approach
Database Approach Advantages
• Minimal data redundancy (data duplication
minimized)
• Data integration (no lack of integration)
• Program – data Independence (no data
dependence)
Three models to represent how data
can be related or linked
• Hierarchical (Tree) Model:
• Network Model
• Relational Model
Database Approach
Hierarchical Model
• files are consolidated into a common pool of
records available to many different application
programs
• Requires the use of a database management
system (DBMS)
©2012 Francisco Delgadillo©
3
Hierarchical Model
Relational Model
• data is organized in a top-down (inverted
tree) structure.
• Parent - child relationships
• one-to-many relationship (one parent,
many children)
• only one access path to any particular data
element
Network Model
Relational Structure
• Most widely used structure
• Data elements are viewed as being stored in
tables
• Row represents record
• Column represents field
• Can relate data in one file with data in another
file if both files share a common data element
Network Model
•
•
•
•
an extension of the hierarchical model.
owner - member relationships
a member may have several owners
more than one path of access
Database Development: Data Model
• A data model is a map or diagram of entities
and their relationships.
• The entity-relationship diagram is an abstract
and conceptual representation of data
• Data modeling usually involves understanding
a specific business problem to be solved and
analyzing the data and information needed to
deliver a solution.
©2012 Francisco Delgadillo©
4
Database Development: E-R Diagrams
• Entity-relationship (ER) diagrams:
– Commonly used when designing databases
– graphical descriptions of entities and the
relationships between entities.
– helps in the design and management of data.
• Relationships include:
Database Development: E-R Diagrams
Entity #1
Relationship
Entity #2
Noun #1
Verb
Noun #2
player
plays
team
– one-to-one (1:1)
– one-to-many (1:N)
– many-to-many (N:M)
Data in a Database - Entities
• Entity is something you collect data about.
For example an item, a person, a place, or a
thing.
• Entities can be thought of as nouns. For
example, computer, artist, employee,
player.
• Entities are represented by rectangles.
Data in a Database - Relationships
• Relationships capture how entities are related to one
another. For example Entities “artist” and “song” can be
related by the Relationship “performs”. Therfore, artistperforms-song.
• Relationships can be thought of as verbs and are
represented by diamonds. Examples are “performs”
“owns” “houses” “supervises”
Entity #1
Relationship
Entity #2
Database Development: E-R Diagrams
• Types of Relationships include:
– one-to-one (1:1)
– one-to-many (1:N)
– many-to-many (N:M)
Database Development: E-R Diagrams
Entity #1
Entity #1
Entity #1
1
1
N
©2012 Francisco Delgadillo©
Relationship
Relationship
Relationship
1
Entity #2
M
Entity #2
M
Entity #2
5
plays
player
Table: player
Football team and stadium
Home_stadium
houses
Team
Football team and games
has
Team
Player
001
Romo
002
Manning
003
Manning
004
Table: plays
team
Database Development: E-R Diagrams
Tomlinson
Player_ID
001
002
003
004
005
Team_ID
001
003
004
001
002
Table: team
001
Cowboys
002
Chargers
Football players and games
003
Colts
plays
004
Giants
005
Jets
player
game
Data in a Database - Representation
• Entities and Relationships are represented in a Relational
Database in Tables
• Each column in a table is called an attribute, which would
be a characteristic of an entity (field name)
• Each row in a table is called a record or a tuple. Each
record consists of many attributes.
• Key: a field in a record that is used to uniquely identify
the record.
Data in a Database (cont.)
Football Team: Entities
Home_stadium
Conference
Team
Games
Player
Football Team - ER example
Entity: Employee
005-10-6322
Crutcher
Sara
12-13-09
534-34-6321
Clinton
Eric
2-23-10
776-54-4525
Doyle
Ryan
11-10-09
342-43-6378
Baker
Kristen
01-15-09
Conference
Home_stadium
partake
house
Team
participate
Game
has
Key Field
Attributes (fields)
Player
©2012 Francisco Delgadillo©
6
Video Rental - ER example
Data in a Database - Representation
• Entities and relationships have attributes which are
represented as ovals and are connected with a line to
their respected entity
• Primary keys (attributes that are unique identifiers) are
underlined
Customer
Movie
SSN
Name
Customer
Actors
Video Rental - ER example
Football Conference Example
Gender
SSN
Customer
Name
Conference
M
DueDate
SSN
Rents
partake
ISBN
ISBN
Team
N
Movie
ISBN
Title
Data in a Database (cont.)
Table: Conference
Table: Team
001
Texas Tech
001
Big 12
002
Texas
002
Big 10
003
USC
003
SEC
004
USC
004
PAC 10
005
Georgia
Key Field
Attributes (fields)
100
200
300
400
600
700
Table: Partake
Team_ID
001
002
003
004
005
Conf_ID
001
001
004
003
003
Movie
Actor_ID
M
Has
Actor_ID
N
Actors
Name
Customer
Mayants
Kacie
Ewing
Star
Wilhelm
Gonzalo
Reed
Brennan
Sanders
Danielle
Pulford
Davison
1-101-1
1-101-2
1-607-9
1-699-4
1-702-5
1-799-2
©2012 Francisco Delgadillo©
F
F
M
M
F
M
Rents
100
200
300
400
700
1-101-1
1-101-2
1-607-9
1-702-5
1-699-4
04/10/12
04/12/12
10/11/11
11/28/11
11/26/11
The Social Network
A Star is Born
Wimbledon
Rome Adventure
Angels in the Outfield
Dumb and Dumber
7
Video Rental - ER example
DBMS
ISBN
Actor_ID
ISBN
Movie
Title
M
Has
N
Actors
Name
Actor_ID
0001
0002
0003
0004
0005
0006
0007
0101
0102
0103
0104
0105
0106
Movie
The Mask
• DBMS: software that provides for the creation,
implementation, usage, and updating of a database.
• schema: a general description of the entire database that
shows all of the record types and their relationships to
each other.
• QBE – Query By Example. Used for Query Design
• SQL – Structured Query Language
• Natural Language Query
Has
Movie_ID Actor_ID
0001
0101
0001
0102
0002
0102
0002
0105
0003
0103
0004
0105
0005
0106
0005
0105
0006
0103
0006
0104
0007
0102
0008
0104
1994
Something About Mary 1998
Bring it On!
2000
Dodge Ball
2004
Happy Gilmore
1996
Spider-Man
2002
Vanilla Sky
2001
Actor
Carrey
Jim
Diaz
Cameron
Dusnt
Kristen
Maguire
Tobey
Stiller
Ben
Sandler
Adam
Source: Courtesy of Microsoft Corp.
DBMS
• Problem with the last tables?
SELECT [Customers].[Company Name],[Customers].[Contact Name]
FROM [Customers]
WHERE not Exists [SELECT [Ship Name] FROM [Orders]
WHERE Month {[Order Date]}=1 and Year{[Order Date]}=2008
and [Customers].[Customer ID]=Orders].{[Customer ID]}
©2012 Francisco Delgadillo©
8
Download