Download Understanding Relational Database Concepts Professor Larry Heimann Carnegie Mellon University

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

SQL wikipedia , lookup

Oracle Database wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Relational algebra wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Ingres (database) wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Functional Database Model wikipedia , lookup

Versant Object Database wikipedia , lookup

Database wikipedia , lookup

ContactPoint wikipedia , lookup

Clusterpoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Understanding Relational
Database Concepts
Professor Larry Heimann
Carnegie Mellon University
88-272 Lecture Notes — Fall 1999
Today’s Hidden Agenda
•
•
•
•
•
•
Announcements and such
Why Relational Databases
Types of Relations
Keys and Key Rings
Integrity in Relational Databases
Types of Data
Now Opening:
Monadnock Book Store
• What functions does the Monadnock Book
Store need to be a successful venture?
• Advantages to using a computer for record
keeping
What Type of Database for MBS?
• Flat file database is easy to understand and
set-up -- even for the computer novices.
• What would a flat file database look like for
MBS?
• What are some of the problems with using a
flat-file database for MBS operations?
A Possible Flat File Database for MBS
Author
C.F. Larry Heimann
Charles E. Hummel
Michael J. Behe
Marc Okrand
Marc Okrand
Philip E. Johnson
C.S. Lewis
C.S. Lewis
C.S. Lewis
C.S. Lewis
C.S. Lewis
C.S. Lewis
C.S. Lewis
Mike Basman
Rick Sternbach
Michael Okuda
C.S. Lewis
C.S. Lewis
Paul Edwards
Arthur Pap
Randal Schwartz
Tom Christiansen
Vicki Brown
Chris Nandor
Title
Acceptable Risks
The Galileo Connection
Darwin's Black Box
The Klingon Way
Klingon for the Galactic Traveler
Reason in the Balance
The Magician's Nephew
The Lion, the Witch and the Wardrobe
The Horse and His Boy
Prince Caspian
The Voyage of the Dawntreader
The Silver Chair
The Last Battle
Chess Openings
STNG: Technical Manual
STNG: Technical Manual
The Screwtape Letters
The Joyful Christian
A Modern Introduction to Philosophy
A Modern Introduction to Philosophy
Learning Perl
Learning Perl
MacPerl: Power and Ease
MacPerl: Power and Ease
Publisher
University of Michigan Press
InterVarsity Press
The Free Press
Pocket Books
Pocket Books
InterVarsity Press
Fontana-Lions
Fontana-Lions
Fontana-Lions
Fontana-Lions
Fontana-Lions
Fontana-Lions
Fontana-Lions
Crowood
Pocket Books
Pocket Books
Collier Books
Collier Books
The Free Press
The Free Press
O'Reilly
O'Reilly
Prime Time Freeware
Prime Time Freeware
Year
1997
1986
1996
1996
1997
1995
1955
1950
1954
1951
1952
1953
1956
1987
1991
1991
1961
1977
1973
1973
1997
1997
1998
1998
ISBN
0-472-10813-1
0-87784-500-X
0-684-82754-9
0-671-53755-5
0-671-00995-8
0-8308-1610-0
0-00-671667-9
0-00-671663-6
0-00-671666-0
0-00-671664-4
0-00-671665-2
0-00-671668-7
0-00-671669-5
0-946284-74-1
0-671-70427-3
0-671-70427-3
0-02-086740-9
0-02-086930-4
0-681-82754-Y
0-681-82754-Y
1-56592-284-0
1-56592-284-0
1-881957-32-2
1-881957-32-2
An Alternative: Relational Databases
• Relational databases consist of a series of
data tables linked together so that data can
later be combined and extracted as needed.
• Some terminology
– table/ file
– column / field
– row / record
tblAuthor
AutID
0150
0151
0152
0153
AutFirstName
Larry
Charles
Michael
Marc
AutLastName
Heimann
Hummel
Behe
Orkand
Codd’s Rule…Condensed Version
• represent all information in the database as tables
• keep the logical representation of data independent from its
physical storage characteristics
• use SQL for structuring, querying, and changing information
in the database
• support the main relational operations (selection, projection,
join) and set up operations such as union, intersection,
difference, and division
• support views, which allow the user to specify alternative ways
of looking at data in tables
• provide a method for differentiating between unknown values
(nulls) and zero or blank
• support mechanisms for integrity, authorization, transactions,
and recovery
A Glimpse at the MBS RDB
tblAuthor
AutID
AutFirstName
AutLastName
AutBioSketch
AutInterview
tblBookAuthor
1
∞
tblSaleDetail
AutID
∞ ISBN
∞
SalesID
ISBN
SalesQuantity
∞
tblSales
1
tblBook
tblPublisher
PubID
PubName
PubAddress
PubCity
PubState
PubZIP
PubPhone
PubFax
1
EditionNumber
CopyrightYear
1
ISBN
∞
PubID
RetailPrice
Rating
CoverPicture
tblCustomer
1
CustID
CustFirstName
CustLastName
CustAddress
CustCity
CustState
CustZIP
CustPhone
CustEmail
CreditCardType
CreditCardNum
CardExp
1
SalesID
SalesDate
∞
CustID
ShipDate
Relations in the MBS Database
• One-to-One Relations
• One-to-Many Relations
• Many-to-Many Relations
• These relationships are represented different
ways depending on the type of model being
used.
Keys in a Relational Database
• How can we be sure we are accessing the
correct records?
• Primary Keys
• Composite Keys
• Foreign Keys
Integrity -- Important in People
and in Databases
• 1st Type: Entity Integrity
• 2nd Type: Domain Integrity
• 3rd Type: Referential Integrity
Potential Problem Areas
• Bad input data
• Operator error
• Mechanical failure
• Malice
• Data Redundancy
What Kind of Data Can We Store?
• Exact numerics
• Approximate numerics
• character strings
• bit strings
• datetimes
• intervals