Vous êtes sur la page 1sur 24

The Importance of a

Relational Database

Concepts in Relational Database Design:


Applications to Public Health
Center for Infectious Disease Preparedness
Updated 2006 August

1
Objectives
„ By the end of this lecture, participants will
be able:
™ To understand why relational databases are
useful for managing epidemiologic data; and
™ To list the steps of designing a relational
database.

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 2
Outbreak Investigation Data
„ Case investigation
„ Contact tracing
„ Episodes of illness
„ Laboratory tests

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 3
Public Health Surveillance Data
„ Personal demographics
„ Case definition
„ Medical conditions
„ Medical care/treatment

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 4
What is a database?
„ A database is a collection of related data
elements
™ Tables (entities)
™ Columns (fields or attributes)
™ Rows (records)

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 5
Why use a database?
„ A database turns disparate pieces of data
into information.
™ Based on needs
™ Collect essential information
™ Principle of parsimony

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 6
Advantages of a Relational
Database.

„ Data integrity
„ Logical and physical data independence
from applications
„ Easy data retrieval

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 7
How do I design a database?
„ Logical design
™ Determine and define fields, tables, keys, and
data integrity
„ Physical implementation
™ Creating tables, establishing key fields, and
table relationships
„ Application development
™ Determine end-user tasks
Center for Infectious Disease Preparedness
UC Berkeley School of Public Health
www.idready.org 8
Why not use a flat-file?

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 9
Issues to Consider
„ How easy is it for me to add information?
„ How easy is it for me to delete
information?
„ How easy is it for me to summarize
information?

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 10
Example 1
„ Collect information on cases in an
outbreak
™ First name
™ Age
™ Gender
™ Ethnicity

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 11
Example 1 continued
First Name Age Gender Ethnicity

Wayne 101 male Filipino

Steve 20 male Caucasian

Maria 34 female Mexican

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 12
Example 2
„ Collect information on cases in an outbreak
™ First name
™ Age
™ Gender
™ Ethnicity

„ Collect information on the contacts of cases


™ First name

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 13
Example 2 continued
First Age Gender Ethnicity Contact1 Contact2 Contact3
Name

Wayne 101 male Filipino Rocio Santiago Craig

Steve 20 male Caucasian Alice Mark

Maria 34 female Mexican Lucas Javier Julian

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 14
Example 2 continued
First Age Gender Ethnicity Contact1 Contact2 Contact3 Contact4
Name

Wayne 101 male Filipino Rocio Santiago Craig

Steve 20 male Caucasian Alice Mark

Maria 34 female Mexican Lucas Javier Julian Max

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 15
Issues to Consider
„ Adding information
™ In the design of the spreadsheet, you have to articulate what the
largest number of contacts are, or add columns as you go along.
™ What would we do if we wanted to collect more than just first
name for contacts?
„ Deleting information
™ If you delete Santiago for Wayne, do you move Craig over to
Contact2 column?
„ Summarizing information
™ Eliminate missing cells before summarizing

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 16
Example 3
First Name Age Gender Ethnicity Contact
Wayne 101 Male Filipino Rocio
Santiago

Craig

Steve 20 male Caucasian Alice


Mark

Maria 34 female Mexican Lucas


Javier

Julian

Max

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 17
Issues to Consider
„ Adding information
™ To insert contacts, we must insert rows.
„ Deleting information
™ If
you delete Rocio for Wayne, do you move
Craig up one row?
„ Summarizing information
™ Eliminate missing cells before summarizing
Center for Infectious Disease Preparedness
UC Berkeley School of Public Health
www.idready.org 18
One Solution
„ Two tables that are related to one another.
™ Case table
™ Contact table

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 19
Case Table
First Name Age Gender Ethnicity CaseID

Wayne 101 male Filipino 1

Steve 20 male Caucasian 2

Maria 34 female Mexican 3

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 20
Contact Table
CaseID Contact
1 Rocio
1 Santiago
1 Craig
2 Alice
2 Mark
3 Lucas
3 Javier
3 Julian
3 Max

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 21
Two Related Tables
First Age Gender Ethnicity CaseID CaseID Contact
Name
Wayne 101 male Filipino 1 1 Rocio
1 Santiago
Steve 20 male Caucasian 2
1 Craig

Maria 34 female Mexican 3


2 Alice
2 Mark
3 Lucas
3 Javier
3 Julian
3 Max

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 22
Course Objectives
„ By the end of this course, participants will be able:
™ To discuss the uses of relational database management systems
for public health activities;
™ To describe the purpose of using Entity-Relationship diagrams;
™ To learn how to map public health surveys and forms into a
relational database;
™ To summarize the process of establishing tables and fields for a
database;
™ To demonstrate the use of Structured Query Language (SQL) to
retrieve data from tables in relational databases.

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 23
Course Topics
„ Identifying data relationships
„ Establishing table structure and
relationships
„ Evaluating a schema
„ Retrieving data from tables using SQL

Center for Infectious Disease Preparedness


UC Berkeley School of Public Health
www.idready.org 24

Vous aimerez peut-être aussi