The Relational Model for
Database Management Systems
CIS 205, Fall 2004
Last edited September 17, 2004By C. Herbert ©2004, all rights reserved
CIS 205 Relational Model p.2
Most modern database management systems use
the Relational Model, in which data is organized
as a set of tables.
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
The Relational Model forDatabase Management Systems
CIS 205 Relational Model p.3
The Relational Model forDatabase Management Systems
Tables are organized into rows and columns.
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
CIS 205 Relational Model p.4
The Relational Model forDatabase Management Systems
Tables are organized into rows and columns.
Each row represents one “record” in the database.
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
CIS 205 Relational Model p.5
The Relational Model forDatabase Management Systems
Tables are organized into rows and columns.
Each column represents a different “field”.
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
CIS 205 Relational Model p.6
The Relational Model forDatabase Management Systems
There is a table for each type of item in a data base.
For example, SEPTA might have a table for drivers, a table to
keep track of buses, and another table for bus routes.
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
Route # Start End
23 3600 S 11th St 9000 Germantown
9 Andorra Plaza Broad and South
2 5400 N. 17th 3300 S. 16th
Bus # Make Model
2078 GM Starliner
2079 Mercedes Dymaxion
2080 GM Sunliner
CIS 205 Relational Model p.7
The Relational Model forDatabase Management Systems
In relational database management, another name
for a table is a relation. We also talk about
entities, attributes and relationships.
An entity is what each table is all about.
There is a table for each entity in a database.
CIS 205 Relational Model p.8
The Relational Model forDatabase Management Systems
There is a table for each entity in a database.
In our SEPTA example we have tables for drivers,
buses, and bus routes.
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
Route # Start End
23 3600 S 11th St 9000 Germantown
9 Andorra Plaza Broad and South
2 5400 N. 17th 3300 S. 16th
Bus # Make Model
2078 GM Starliner
2079 Mercedes Dymaxion
2080 GM Sunliner
CIS 205 Relational Model p.9
The Relational Model forDatabase Management Systems
The word entity refers to the general object
for each table. Each specific object is called
an instance of the entity.
There is a row for each instance of the entity.
CIS 205 Relational Model p.10
The Relational Model forDatabase Management Systems
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
There is a row for each instance of the entity.
CIS 205 Relational Model p.11
The Relational Model forDatabase Management Systems
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
An attribute is something that provides information about, or describes, an entity.
There is a column for each attribute of the entity.
CIS 205 Relational Model p.12
The Relational Model forDatabase Management Systems
A relationship is formed when two tables share
an attribute. (have a common column)
Data in one table is “cross referenced” with data in
another table through the column they have in
common. (the shared attribute)
“Cross-referencing” data is one of the keys to
effective database management.
CIS 205 Relational Model p.13
The Relational Model forDatabase Management Systems
In our SEPTA example, bus routes can be cross
referenced with buses to find out what make and
model of bus is being used on each route.
Route # Start End Bus #
23 3600 S 11th St 9000 Germantown 2078
9 Andorra Plaza Broad and South 2080
Bus # Make Model
2078 GM Starliner
2079 Mercedes Dymaxion
2080 GM Sunliner
CIS 205 Relational Model p.14
The Relational Model forDatabase Management Systems
In our SEPTA example, bus routes can be cross
referenced with buses to find out what make and
model of bus is being used on each route.
Route # Start End Bus #
23 3600 S 11th St 9000 Germantown 2078
9 Andorra Plaza Broad and South 2080
Bus # Make Model
2078 GM Starliner
2079 Mercedes Dymaxion
2080 GM Sunliner
Here, we can see that a GM Starliner is scheduled for use
on Route 23. Is it too big for the streets on that route?
CIS 205 Relational Model p.15
The Relational Model forDatabase Management Systems
In order for this cross referencing to work, we must
be able to uniquely identify each instance of an
entity. In other words, each row in a table must
have a unique value for a particular column.
Bus # Make Model
2078 GM Starliner
2079 Mercedes Dymaxion
2080 GM Sunliner
We call such a column the primary key for the table. The primary key uniquely identifies each instance of an entity.
CIS 205 Relational Model p.16
The Relational Model forDatabase Management Systems
Here the Bus # is different for each row in the
database. The Bus # can be used as the primary
key for the bus table.
Bus # Make Model
2078 GM Starliner
2079 Mercedes Dymaxion
2080 GM Sunliner
We call such a column the primary key for the table. The primary key uniquely identifies each instance of an entity.
CIS 205 Relational Model p.17
The Relational Model forDatabase Management Systems
A column in one table that is the primary key for
another table is called a foreign key.
Route # Start End Bus #
23 3600 S 11th St 9000 Germantown 2078
9 Andorra Plaza Broad and South 2080
Bus # Make Model
2078 GM Starliner
2079 Mercedes Dymaxion
2080 GM Sunliner
CIS 205 Relational Model p.18
The Relational Model forDatabase Management Systems
Here, Bus # is a foreign key in the bus route
table, because it is a primary key in the bus table.
Route # Start End Bus #
23 3600 S 11th St 9000 Germantown 2078
9 Andorra Plaza Broad and South 2080
Bus # Make Model
2078 GM Starliner
2079 Mercedes Dymaxion
2080 GM Sunliner
Foreign keyPrimary key
CIS 205 Relational Model p.19
Sometimes a single column is not enough to form
a key field.
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
The Relational Model forDatabase Management Systems
CIS 205 Relational Model p.20
In this table, the Name column by itself could be a
primary key, assuming no two names are the
same.
Name Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
The Relational Model forDatabase Management Systems
CIS 205 Relational Model p.21
However, if the first name and last name are in
separate columns, then both must be used to form
a primary key.
First Name
Last Name
Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313
The Relational Model forDatabase Management Systems
CIS 205 Relational Model p.22
A key that is formed from more than one column is
called a composite key.
The Relational Model forDatabase Management Systems
First Name
Last Name
Address Phone Number
Joe Smith 111 Oak Ave 555-1111
Mary Jones 222 Main St 555-1212
George Bush 1600 Penn. Ave 555-1000
John Kerry 12 Lexington Rd 555-1313