Professional Documents
Culture Documents
Relational Databases
Relational Databases
Basic Concepts
a database is an collection of logically related records
a relational database stores its data in 2-dimensional
tables
a table is a two-dimensional structure made up
of rows (tuples, records) and columns (attributes, fields)
example: a table of students engaged in sports activities,
where a student is allowed to participate in at most one
activity
StudentID
100
150
175
200
Activity
Skiing
Swimming
Squash
Swimming
Fee
200
50
50
50
Table Characteristics
each row is unique and stores data about one entity
row order is unimportant
each column has a unique attribute name
each column (attribute) description (metadata) is stored in
the database
Access metadata is stored and manipulated via the
Table Design View grid
column order is unimportant
all entries in a column have the same data type
Access examples: Text(50), Number(Integer),
Date/Time
each cell contains atomic data: no lists or sub-tables
Relational Database Design
Activity
Skiing
Swimming
Squash
Swimming
Fee
200
50
50
50
Activity
Skiing
Golf
Squash
Swimming
Swimming
Golf
Fee
200
65
50
50
50
65
State
NJ
NJ
CT
MA
NJ
Make
Honda
Buick
Toyota
Ford
Nissan
Model
Accord
Regal
Corolla
Windstar
Altima
Year
2003
1998
2002
2001
2006
StateName
Connecticut
Michigan
South Dakota
Tennessee
Texas
Union
Order
5
26
40
16
28
StateBird
American robin
robin
pheasant
mocking bird
mocking bird
State
Population
3,287,116
9,295,297
696,004
4,877,185
16,986,510
CITY table:
State
Abbrev
CT
CT
CT
MI
SD
SD
TN
TX
TX
CityName
Hartford
Madison
Portland
Lansing
Madison
Pierre
Nashville
Austin
Portland
City
Population
139,739
14,031
8,418
127,321
6,257
12,906
488,374
465,622
12,224
Entity-Relationship Diagrams
Transitive Dependencies
a transitive dependency
dependen is a functional dependency
whose determinant is not the primary key, part of the
primary key, or a candidate key
example: ACTIVITY(StudentID, Activity, Fee)
Activity
Skiing
Golf
Squash
Swimming
Swimming
Golf
Fee
200
65
50
50
50
65
StudentID
StudentID
100
100
175
175
200
200
Activity
Skiing
Golf
Squash
Swimming
Swimming
Golf
Fee
200
65
50
50
50
65
Fee
Activity
10
Activity
Skiing
Golf
Swimming
Squash
Swimming
Swimming
Golf
Activity
Skiing
Golf
Swimming
Squash
ScubaDiving
Fees
200
65
50
50
200
11
Activity
Skiing
Golf
Swimming
Squash
Swimming
Swimming
Golf
Activity
Skiing
Golf
Swimming
Squash
ScubaDiving
Fees
200
65
50
50
200
12
13