Escolar Documentos
Profissional Documentos
Cultura Documentos
| ||
!
To every rule,
there is an exception!
|
!"#
| |||
| ||
!
Topics
- Theory:
What is Database Design
Basic Elements
Representing the Model as Tables
- Practice
An Example
- Some Other Topics
|
!"#
| |||
| ||
!
Basic Elements
See http://bit.csc.lsu.edu/~chen/chen.html
|
!"#
| |||
| ||
!
r
In May, 1995,
Andrew Wiles
published
a proof
of Fermat¶s Last Theorem
|
!"#
$
| |||
| ||
!
- Identifying attributes
Must be able to uniquely identify the entity
Can have more than one way to id
Id can be composite
- Descriptive attributes
the values you need to keep track of
generally should be simple, not complex
- Keep it simple
- Be accurate
- Keep it up to date
|
!"#
%
| |||
| ||
!
|
!"#
&
| |||
| ||
!
Simply put,
- Entities become tables
Identifiers become indexes
- Attributes become columns
Data types: pick appropriate
- Relationships become tables or foreign keys
|
!"#
| |||
| ||
!
An example
- Music store
Buys compact disc recordings from
distributors
Has inventory
Allows customers to search for what they want
± Maybe in an in-store kiosk or on the web
Sells compact discs to customers
Activities
|
!"#
'
| |||
| ||
!
- Discs we have
- Discs we sold
- Discs we know about and can get
- Discs we have ordered
- Information needed to do our income tax
what we paid for stock
when we bought it
what we sold it for
when we sold it
Disc entities
|
!"#
(
| |||
| ||
!
What¶s wrong?
|
!"#
| |||
| ||
!
Discs revisited
- Discs - Tracks
- Manufacturers - Songs
- Distributors - Performers
- Orders - Groups ?
- Customers
- Inventory
|
!"#
| |||
| ||
!
|
!"#
| |||
| ||
!
Performance data
Performer data
id name
1 ¢oshua Bell
2 Sir Roger Norrington
3 Camerata Salzburg
4 Michael Tilson Thomas
5 Berlin Philharmonic
6 Bono
7 The Edge
8 Adam Clayton
9 Larry Mullen
|
!"#
| |||
| ||
!
Performance to Performer
Relationship
performance id performer id
1 1
1 2
1 3
1 «
2 1
2 4
2 5
2 «
325 6
325 7
325 8
325 9
40 © 2007 Progress Software Corporation
Performance id 2
Title Violin Concerto in E Minor, Op. 64
Time 6:27
Composer Felix Mendelssohn
Category Classical, violin, orchestra
Track to Performance
Relationship
|
!"#
$
| |||
| ||
!
track
performance
performance
disc performer
track
performance
track
one to many
many to many
track
song
performance
track
song
one to many
performance
one to one
performance
disc performer
track performance
track performance
one to many
performer
track performance
many to many
|
!"#
%
| |||
| ||
!
disc
track song
performance
performer
track song
performance
performer
track song
performance
What about
³business entities´
?
Business entities
disc
track song
performance
performer
track song
performance
performer
track song
performance
|
!"#
&
| |||
| ||
!
Business entities
disc
track song
performance
performer
track song
performance
performer
track song
performance
Business entities
disc
track song
performance
performer
track song
performance
performer
track song
performance
|
!"#
| |||
| ||
!
Indexes
- Enforce uniqueness
- Make searches faster
- Enable fast retrieval of entities by their
identities
- Enable finding entities with certain attributes
Tables
0) Discs
1) Tracks
2) Songs
3) Performers
4) Performances
5) Tracks of discs
6) Performances of songs
7) Performers of performances
|
!"#
'
| |||
| ||
!
Other Topics
- Normalization
- Unique keys
- Word indexes
- Naming
- Customisation
|
!"#
(
| |||
| ||
!
Normalization
- Oversimplified, it means:
Don¶t duplicate data
- Attributes should be simple
have only one value
be necessary
not derived data
don¶t repeat
- Complicated attributes are often entities in
their own right
For example, addresses might be
Unique keys
Word indexes
- Example:
Category: classical, violin, orchestral, concerto
|
!"#
| |||
| ||
!
Naming
Naming
|
!"#
| |||
| ||
!
|
!"#
| |||
| ||
!
Modeling Tools
- PCase
- Enterprise Architect
- Power Designer
- ConceptDraw
- Erwin
- Rational
|
!"#
| |||
| ||
!
Summary
Homework
- Papers
Wiles, A.: "Modular elliptic curves and Fermat's Last
Theorem´, þ
M 141 (3): 443-551
Chen, P.: ³The Entity-Relationship Model -- Toward a
Unified View of Data´, þ
Vol 1, No 1, 1976
- Wikipedia articles to start from:
entity-relationship model
data model
- Books:
Teorey, Lightstone, Nadeau: ·
, Morgan Kaufmann.
ë
|
!"#
$
| |||
| ||
!
|
!"#
%