THE RELATIONAL DATABASE MODEL & THE DATABASE DEVELOPMENT PROCESS The little reed, bending to the...
-
Upload
cora-stanley -
Category
Documents
-
view
214 -
download
0
Transcript of THE RELATIONAL DATABASE MODEL & THE DATABASE DEVELOPMENT PROCESS The little reed, bending to the...
THE RELATIONAL DATABASE MODEL & THE DATABASE DEVELOPMENT PROCESS
The little reed, bending to the force of the wind, soon stood upright again when the storm had passed over. ~ Aesop ~
Learning Objectives
Describe the Relational Model Define relational terms and understand
the terminology in practice. Understand these relational terms
through practice Explain the System Development Life
Cycle (SDLC) Explain the Database Life Cycle (DBLC)
Fundamental Axioms of DBMSs
Users communicate with computer applications (websites, etc)
Computer applications communicate with DBMSs.
Users do not communicate with DBMSs directly.
As a result DBMSs although they can be used interactively, are not used interactively.
A DBMS is not a replacement for sound database design principles.
The Relational Database Model Many DBMS applications implement the Relational
Model, but none of them enforce it. This permits rookie database designers to shoot themselves in the foot. And many have (including yours truly).
The Relational Model has: (Codd’s 3 rules) 1)Data Independence
Clear separation between data and metadata 2) Data Consistency
Minimal redundancy; the data adopts the “DRY” principle
3) Easy to use You don’t have to understand the implementation to
use it.
You can build a poorly-designed DB in a DBMS
Do you see problems with this database design?Think Codd: Independence? Consistency? Ease-of-
Use?
Change Sally Jones’s phone #? How many ‘Software’ in the database? Add New Employee Bob Smith? Delete Dave Smith (no longer works here)
Asset# Item Category Employee Phone Date Out1 The ABC's of Excel Book Dave Smith 3321 9-Jun2 InFocus Projector Hardware Sally Jones 4539 2-Jun3 Prog. for Dummies Book Art Wilson 9091 20-Jun4 Learning Perl Book
Keith Way 33825 Dell Laptop #1 Hardware Sally Jones 4539 20-Jun6 Windows 2000 Server Solftware7 Office 2000 Premium Software Dave Smith 3321 12-Jun8 Dell Laptop #2 Hardware
Resource Sign-out Sheet
Activity: Relational Terminology
Identify Each of These :
Table Relation Row Column Tuple Attribute Physical
Domain Logical
Domain
Item Category Asset#The ABC's of Excel Book 1InFocus Projector Hardware 2Prog. for Dummies Book 3Learning Perl Book 4Dell Laptop #1 Hardware 5Windows 2000 Server Software 6Office 2000 Premium Software 7Dell Laptop #2 Hardware 8
Asset
DBMS : Physical Domain
Different “flavors” of DBMSs use different data types.
DBMS: Logical Domain
Default Value – a value entered into an attribute for a row when one isn’t specified.
Check Constraint – an expression which must be evaluated prior to the insertion of a row. Eg. Employee_hourly_wage >= 0
Unique Constraint – ensures duplicate values are not inserted into a column. (Secondary Keys should have unique constraints)
Lookup table – a separate table containing all of the acceptable values for a given column, typically varchar (Think drop down list) The column you’re trying to constrain is a FK to the lookup table.
Example: Lookup Table
Item Category Asset#The ABC's of Excel Book 1InFocus Projector Hardware 2Prog. for Dummies Book 3Learning Perl Book 4Dell Laptop #1 Hardware 5Windows 2000 Server Software 6Office 2000 Premium Software 7Dell Laptop #2 Hardware 8
Asset
CategoryID
Book
Hardware
Software
Foreign Key
Activity: The Relational Table
Relation Name?Attributes?Physical Domain of Columns?
Logical Domain of Columns?Candidate Keys?
Activity: Find the keys Candidate? Primary? Secondary? Foreign?
Surrogate?
One more time.
Rule for joining tables
Tables
Columns: Phys. Domain. Log Domain? Null?
Keys: Candidate? Primary? Foreign, Surrogate, Secondary?
Activity: Which of these is a good PK?
Candidate keys? Best primary key? Why? Should a Surrogate key be used?
The Natural Join at Work
NaturalJoin
Activity: Where’s the Integrity?
TableAApk
223
Bpk BfkA BfkC101 2 A102 3 D103 C104 3 C
TableB TableCCpkABC
Dpk DfkB1X 102
1023X 103
TableD Which of the 4 tables exhibit Entity Integrity?
Which of the 3 relationshipsexhibit Referential Integrity?
Example: Implementation of a 1-M Relationship
Example: Implementation of a M-N Relationship
This M-M Relationship has been resolved intotwo 1-M relationships
Example:Null and Flags
EID Ename ETermDate EBenefitPlan101 Willie Survive BluePoint102 Mike Rophone 01/01/04103 Curt Tens 02/13/04104 Sara Doctorintahaus OrangePoint105 Dustin Dawind
Employee
EID Ename ETermDate EBenefitPlan101 Willie Survive BluePoint102 Mike Rophone 01/01/04 Term103 Curt Tens 02/13/04 Term104 Sara Doctorintahaus OrangePoint105 Dustin Dawind Op-Out
Employee
Null makes sense for this
column
103 and 105 are null for different reasons!
Flags used to represent
different status
Nulls typically cause problems in Varchar andNumeric, and bit fields
Data Models: Abstraction Levels
Conceptual
Internal
External
Physical
Logical
Highly AbstractHardware and Software
Independent
Somewhat Abstract Hardware IndependentSoftware Dependent
Not Abstract (Concrete)Hardware and Software Dependent
Systems Development Lifecycle
IPlanning
IIAnalysis
IIIDesign
IVImplementation
VMaintenance &
Support
Time
Res
ourc
es
Conceptual Model
LogicalModel
Internal / ExternalModel
SDLC / DBLC
PhysicalModel
THE RELATIONAL DATABASE MODEL & THE DATABASE DEVELOPMENT PROCESS
Questions?