Professional Documents
Culture Documents
Chapter 4
STUDENT
Student
Student Student Phone Student
Student ID Last Name First Name Number Birth Date
STUDENT
Student
Student Student Phone Student
Student ID Last Name First Name Number Birth Date
STUDENT
Student
Student Last Student Phone Student
Student ID Name First Name Number Birth Date
333-33-3333 Simpson Alice 333-3333 10/11/84
111-11-1111 Sanders Ned 444-4444 11/24/86
Student
File Class
File
Advisor
File
Copyright © 2015 Pearson Education, Inc.
FILE VS. DATABASES
• Database systems were developed to address the
problems associated with the proliferation of
master files.
▫ For years, each time a new information need
arose, companies created new files and programs.
▫ The result: a significant increase in the number of
master files.
• DBMS Languages
▫ Every DBMS must provide a means of
performing the three basic functions of:
Creating a database
Changing a database
Querying a database
STUDENT-COURSE
Student ID Course ID
A primary key is the
333-33-3333 1234 attribute or combination
333-33-3333 1236 of attributes that
111-11-1111 1235 uniquely identifies a
111-11-1111 1236 specific row in a table.
Copyright © 2015 Pearson Education, Inc.
STUDENT
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503
ADVISOR
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
• If Ned withdraws from all his classes and you eliminate all three of
his rows from the table, then you will no longer have a record of
Ned. If Ned is planning to take classes next semester, then you
probably didn’t really want to delete all records of him.
• This problem is referred to as a delete anomaly.
Copyright © 2015 Pearson Education, Inc.
COURSE
CourseID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT COURSE • The solution to the preceding problems
StudentID CourseID is to use a set of tables in a relational
333-33-3333 1234 database.
333-33-3333 1236 • Each entity is stored in a separate table,
111-11-1111 1235 and separate tables or foreign keys can
111-11-1111
Copyright 1236Inc.
© 2015 Pearson Education, be used to link the entities together.
© 2012 Pearson Education, Inc. Accounting Information Systems, Romney/Steinbart
• Add a
STUDENTS
student
Last First Phone
here.
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333 • Leaves no
111-11-1111 Sanders Ned 444-4444 blank
123-45-6789 Moore Artie 555-5555
spaces.
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT COURSE
StudentID CourseID • Add a course here.
333-33-3333 1234 • Leaves no blank spaces.
333-33-3333 1236
111-11-1111 1235 • When a particular student enrolls for a
111-11-1111 1236 Inc.
Copyright © 2015 Pearson Education,
particular course, add that info here.
© 2012 Pearson Education, Inc. Accounting Information Systems, Romney/Steinbart
STUDENTS
Last First Phone • Ned still
Student ID Name Name No. exists in
333-33-3333 Simpson Alice 333-3333 the
111-11-1111 Sanders Ned 444-4444 student
123-45-6789 Moore Artie 555-5555 table.
COURSES
Course ID Course Section Day Time
1234 ACCT-3603 1 MWF 8:30
1235 ACCT-3603 2 TR 9:30
1236 MGMT-2103 1 MW 8:30
STUDENT COURSE
StudentID CourseID • Even if Ned was the only student in
the class, ACCT-3603 still exists in
333-33-3333 1234
the course table.
333-33-3333 1236
111-11-1111 1235 • If Ned Sanders drops ACCT-3603,
111-11-1111 1236 Inc.
Copyright © 2015 Pearson Education, remove Ned’s class from this table.
© 2012 Pearson Education, Inc. Accounting Information Systems, Romney/Steinbart
RELATIONAL DATABASES
• Basic Requirements of a Relational
Database
▫ Every column in a row must be single valued.
In other words, every cell can have one and only one
value.
In the student table, you couldn’t have an attribute
named “Phone Number” if a student could have
multiple phone numbers.
There might be an attribute named “local phone
number” and an attribute named “permanent phone
number.”
You could not have an attribute named “Class” in the
student table, because a student could take multiple
Copyright © 2015 classes.
Pearson Education, Inc.
RELATIONAL DATABASES
• Basic Requirements of a Relational
Database
▫ The primary key cannot be null.
The primary key uniquely identifies a specific row in
the table, so it cannot be null, and it must be unique
for every record.
This rule is referred to as the entity integrity
rule.
ADVISOR
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203
Primary Keys