Databases and DBMSS: Todd S. Bacastow January 2005
Databases and DBMSS: Todd S. Bacastow January 2005
Databases and DBMSS: Todd S. Bacastow January 2005
Todd S. Bacastow
January 2005
1
IST 210
Evolution
IST 210
Ways of storing data
Files (1960) (ancient times)
Databases
Hierarchical (1970)
Network (1970)
Relational (1980)
Object (1990)
IST 210
File terms
Record
data items related to a single logical entity
(e.g. a student’s information) or row in a table
Field
a place for a data item in a record (first name
field in a student record) or a column in a table
File
a sequence of records of the same type (the
table)
IST 210
File structures
A file: “STUDENT”
field
3 Smith Jane A
1 Wood Bob C
record
2 Kent Chuck B
4 Boone Dan B
IST 210 File organization
Serial
new records appended
Sequential
records ordered in file, usually according to
a numeric key
IST 210
File structures
Serial
ID Last First Grade
list of entries in 3 Smith Jane A
which the order
1 Wood Bob C
of entry into the
list determines 2 Kent Chuck B
the order of the 4 Boone Dan B
list
IST 210
File structures
Network
Relational
Object
IST 210
Network model
IST 210
Network data model
Class
Relationships:
• one-to-one
• one-to-many
Student Instructor
• many-to-one
• many-to-many
Grade ID Department
IST 210
Network data model
Advantages
flexible, fast, efficient
Disadvantages
Complex
Restructuring can be difficult because of
changing all the pointers
IST 210
Hierarchical database model
IST 210
Hierarchical data model
Class
Parent-child
relationship:
one-to-one Student Instructor
one-to-many
Grade ID Department
IST 210
Hierarchical data model
Advantages
easy to search
add new branches easily
Disadvantages
Must establish the types of search prior to
development of the hierarchical structure
IST 210
Summary
Hierarchical and network data models have
generally been replaced by the relational data
model
Relational databases dominate the database
market
Oracle
Informix
SQL Server
DB2
……..
IST 210
Relational database model
Stores both
Data about real
world objects
(entities) in
tables
Relationships
between the
tables
IST 210
Relational database
Fields (columns) in the
table store attributes.
Each attribute has a
specific domain.
Tuples (or records or
rows) in the table store
information.
Each tuple is a unique
instance of an object.
Tables are composed of
a set of tuples.
A table is also called a
relation.
IST 210
Terms
Table
A collection of relevant data relating to one type of real world
objects.
Column
A specific place for one type of data relating to one type of
real world objects.
Domain
Set of all possible values for a specific column.
Row
Collection of data describing one real world object.
Primary Key
Columns, which are part of the row and uniquely identify any
one row.
IST 210 Records
Each record represents a logical entity (e.g. a
student)
Each field represents an attribute of the
logical entity
Student
ID Last First Grade Class
1 Wood Bob C IST357
2 Kent Chuck B IST115
3 Smith Jane A IST357
4 Boone Dan B IST357
IST 210
Keys
Each table has a primary key, one field (or a
combination of fields) that has a unique value for
each and every record in the table
Student
ID Last First Grade Class
ID is the primary key 1 Wood Bob C IST357
in this table (two
students may share 2 Kent Chuck B IST115
either a last or first 3 Smith Jane A IST357
name)
4 Boone Dan B IST357
IST 210
Relating tables
Tables can be related (joined) together based on their keys
The idea is to decompose into separate tables with no
redundancy and to provide a capability to reassemble with no
information loss
Student
Class
ID Last First Grade Class
Name #Stud Instructor
1 Wood Bob C IST357
IST357 48 Jones
2 Kent Chuck B IST115
IST115 120 Brower
3 Smith Jane A IST357
IST20 120 Fountain
4 Boone Dan B IST357
IST 210 Relating tables
Primary key Foreign key Primary key
Student
Class
ID Last First Grade Class
1 Wood Bob C IST357 Name #Stud Instructor
IST357 48 Jones
2 Kent Chuck B IST115
IST115 120 Brower
3 Smith Jane A IST357
IST20 120 Mennis
4 Boone Dan B IST357
IST 210 Relating tables
Student
ID Last First Grade Class Class
Name #Stud Instructor
1 Wood Bob C IST357
IST20 120 Brower
2 Kent Chuck B IST115
IST115 120 Jones
3 Smith Jane A IST357
IST357 48 Jones
4 Boone Dan B IST357
Instructor
Name Office
Jones 332
Brower 517
IST 210
DBMS Schema
Ultimately data in databases is stored in
files, but their structure is hidden