Download Database Concepts

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

Tandem Computers wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Relational algebra wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

Database wikipedia , lookup

Database model wikipedia , lookup

Relational model wikipedia , lookup

Transcript
THE RELATIONAL DATABASE
MODEL & THE DATABASE
DEVELOPMENT PROCESS
Fact of the Week:
According to a Gartner study in ‘06, Microsoft
SQL server had the highest annual growth of
any proprietary DBMS at 28% increasing
market share from 15.6% to 17.4%
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


2) Data Consistency


Clear separation between data and metadata
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?
Asset#
1
2
3
4
5
6
7
8
Resource Sign-out Sheet
Item
Category Employee Phone Date Out
The ABC's of Excel
Book
Dave Smith
3321
9-Jun
InFocus Projector
Hardware Sally Jones
4539
2-Jun
Prog. for Dummies
Book
Art Wilson
9091
20-Jun
Learning Perl
Book
Keith Way
3382
Dell Laptop #1
Hardware Sally Jones
4539
20-Jun
Windows 2000 Server Solftware
Office 2000 Premium Software Dave Smith
3321
12-Jun
Dell Laptop #2
Hardware
Change Sally Jones’s phone #? How many ‘Software’ in the database?
Add New Employee Bob Smith? Delete Dave Smith (no longer works here)
Activity: Relational Terminology
Identify Each of
These :
 Table
 Relation
 Row
 Column
 Tuple
 Attribute
 Physical Domain
 Logical Domain
Asset
Item
Category Asset#
The ABC's of Excel Book
1
InFocus Projector
Hardware
2
Prog. for Dummies
Book
3
Learning Perl
Book
4
Dell Laptop #1
Hardware
5
Windows 2000 Server Software
6
Office 2000 Premium Software
7
Dell Laptop #2
Hardware
8
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
Asset
Item
Category Asset#
The ABC's of Excel
Book
1
InFocus Projector
Hardware
2
Prog. for Dummies
Book
3
Learning Perl
Book
4
Dell Laptop #1
Hardware
5
Windows 2000 Server Software
6
Office 2000 Premium Software
7
Dell Laptop #2
Hardware
8
CategoryID
Foreign Key
Book
Hardware
Software
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.
Tables
Rule for joining 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
Natural
Join
Activity: Where’s the Integrity?
TableB
Bpk BfkA BfkC
101
2A
102
3D
103
C
104
3C
TableA
Apk
2
2
3
TableD
Dpk DfkB
1X
102
102
3X
103
TableC
Cpk
A
B
C
Which of the 4 tables
exhibit Entity Integrity?
Which of the 3 relationships
exhibit Referential Integrity?
Example: Implementation
of a 1-M Relationship
Example: Implementation of a
M-N Relationship
This M-M Relationship
has been resolved into
two 1-M relationships
Example:Null and Flags
Nulls typically cause
problems in Varchar and
Numeric, and bit fields
Employee
EID
101
102
103
104
105
Ename
ETermDate EBenefitPlan
Willie Survive
BluePoint
Mike Rophone
01/01/04
Curt Tens
02/13/04
Sara Doctorintahaus
OrangePoint
Dustin Dawind
103 and 105 are
null for different
reasons!
Null makes sense
for this column
Employee
EID
101
102
103
104
105
Ename
ETermDate EBenefitPlan
Willie Survive
BluePoint
Mike Rophone
01/01/04 Term
Curt Tens
02/13/04 Term
Sara Doctorintahaus
OrangePoint
Dustin Dawind
Op-Out
Flags used to
represent
different status
Data Models: Abstraction Levels
Conceptual
Logical
Internal
Highly Abstract
Hardware and Software
Independent
Somewhat Abstract
Hardware Independent
Software Dependent
External
Physical
Not Abstract (Concrete)
Hardware and Software Dependent
Systems Development Lifecycle
SDLC / DBLC
II
Analysis
III
Design
IV
Implementation
Resources
I
Planning
Logical
Model
Conceptual
Model
Physical
Model
Time
Internal / External
Model
V
Maintenance &
Support
THE RELATIONAL DATABASE
MODEL & THE DATABASE
DEVELOPMENT PROCESS
Questions?