Diapositive 1
Download
Report
Transcript Diapositive 1
Information Systems
Chapter 3:
Relational Databases
• A relational database is:
– A set of related tables that is created and managed by a database
management system (DBMS)
– Tables are linked using common data fields
– Integrity rules are part of the database and are enforced by the DBMS
• A relational DBMS (RDBMS) should provide the following
facilities:
– Query interface
– Transactions processing
– Concurrent access
– Security
Example
• Another description:
– PUBLISHERS(publisherId,publisherName)
– TITLES(isbn,title,editionNumber,description,publis
herId,copyright,imageFile,price)
– AUTHORISBN(isbn,authorId)
– AUTHORS(authorId,firstName,lastName)
• And a last one:
isbn
0130923613
0130622214
0130341517
0130649341
0130895601
0130308978
0130293636
0130895636
0130895512
Fig. 22.10
title
editionNumber
Python How to Program
1
C# How to Program
1
Java How to Program
4
The Complete Java Training 4
Course
Advanced Java 2 Platform 1
How to Program
Internet and World Wide
2
Web How to Program
Visual Basic .NET How to 2
Program
The Complete C++ Training 3
Course
The Complete e-Business & 1
e-Commerce Programming
Training Course
publisherID
price
1
1
1
2
copyright
2002
2002
2002
2002
1
2002
$69.95
1
2002
$69.95
1
2002
$69.95
2
2001
$109.95
2
2001
$109.95
Portion of the data from the Titles table of Books.mdb.
$69.95
$69.95
$69.95
$109.95
authorID firstName lastName
1
Harvey
Deitel
2
Paul
Deitel
3
Tem
Nieto
4
Kate
Steinbuhler
5
Sean
Santry
6
Ted
Lin
7
Praveen
Sadhu
8
David
McPhie
9
Cheryl
Yaeger
10
Marina
Zlatkina
11
Ben
Wiedermann
12
Jonathan
Liperi
Fig. 22.4 Data from the Authors table of
Books.mdb.
Primary Definitions
• Table, a set of columns that contain data. In the
old days, a table was called a file.
• Row, a set of columns from a table reflecting a
record.
• Index, an object that allows for fast retrieval of
table rows. Every primary key and foreign key
should have an index for retrieval speed.
• Primary key, often designated pk, is 1 or more
columns in a table that makes a record unique.
• Foreign key, often designated fk, is a common
column common between 2 tables that define
the relationship between those 2 tables.
• Foreign keys are either mandatory or optional.
Mandatory forces a child to have a parent by
creating a not null column at the child. Optional
allows a child to exist without a parent, allowing
a nullable column at the child table (not a
common circumstance).
• Entity Relationship Diagram
– or ER is a pictorial representation of the application
schema (see the next chapter).
• Constraints
– are rules residing in the database’s data
dictionary governing relationships and
dictating the ways records are manipulated,
what is a legal move vs. what is an illegal
move. These are of the utmost importance
for a secure and consistent set of data.
• Data Manipulation Language or DML, sql
statements that insert, update or delete database
in a database.
• Data Definition Language or DDL, sql used
to create and modify database objects used in an
application schema.
Relational Design
• The design of the application schema will
determine the usability and query ability of the
application.
• Done incorrectly, the application and users will
suffer until someone else is forced to rewrite it.
• Main chalenge: How to efficiently design a
“good” relational database
• see next chapters