0% found this document useful (0 votes)
26 views117 pages

Topic 05

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views117 pages

Topic 05

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 117

BBFE 21342– Management Information Systems

Topic 05 – Databases and


Information Management

Mr. Jayanath Samarawickrama


B.Sc. Bus. Admin. (Information Systems) (Sp.) (USJ), M.Sc.
(Computer Science) (USJ), MCS (SL)
Lecturer

Department of Finance

E-Mail – [email protected]

BBFE 21342– MANAGEMENT INFORMATION SYSTEMS 1


Learning Outcomes

• Describe the term ‘Business Intelligence’


• Discuss the importance of databases
• Describe the key concepts of relational databases
• Design databases for business organizations
using the Entity Relationship model

BBFE 21342– Management Information Syste 2


ms
Topic Outline

Managing Entity
Data Relationship
Resources Modelling

BBFE 21342– Management Information Syste 3


ms
Managing Data Resources

BBFE 21342– Management Information Syste 4


ms
Business Intelligence

• Business intelligence (BI) refers to the procedural and


technical infrastructure that collects, stores, and
analyzes the data produced by a company’s activities.

• BI is a broad term that encompasses data mining,


process analysis, performance benchmarking, and
descriptive analytics. BI parses all the data generated
by a business and presents easy-to-digest reports,
performance measures, and trends that inform
management decisions.
BBFE 21342– Management Information Syste 5
ms
Business Intelligence – Key Takeaways

• BI represents the technical infrastructure that collects, stores, and


analyzes company data.
• BI parses data and produces reports and information that help
managers to make better decisions.
• Software companies produce BI solutions for companies that wish
to make better use of their data.
• BI tools and software come in a wide variety of forms such as
spreadsheets, reporting/query software, data visualization
software, data mining tools, and online analytical processing
(OLAP).
• Self-service BI is an approach to analytics that allows individuals
without a technical background to access and explore data.
BBFE 21342– Management Information Syste 6
ms
Types of BI Tools and Software

Data visualization software:


Spreadsheets: Spreadsheets Reporting software: Data visualization software
like Microsoft Excel and Reporting software is used to translates datasets into easy-
Google Docs are some of the report, organize, filter, and to-read, visually appealing
most widely used BI tools. display data. graphical representations to
quickly gain insights.

Data mining tools: Data Online analytical processing


mining tools "mine" large (OLAP): OLAP tools allow
amounts of data for patterns users to analyze datasets from
using things like artificial a wide variety of angles based
intelligence, machine on different business
learning, and statistics. perspectives.

BBFE 21342– Management Information Syste 7


ms
Introduction - Databases

• Relational databases underlie most


modern integrated information systems.
– They are the most popular type of database used
for transaction processing.
– In this lesson, we’ll define the concept of a
database.

BBFE 21342– Management Information Syste 8


ms
File Organization Terms and Concepts

• Bit: Smallest unit of data; binary digit (0,1)

• Byte: Group of bits that represents a single character

• Field: Group of words or a complete number

• Record: Group of related fields

• File: Group of records of same type

BBFE 21342– Management Information Syste 9


ms
File Organization Terms and Concepts

• Database: Group of related files

• Entity: Person, place, thing, event about which


information is maintained

• Attribute: Description of a particular entity

• Key field: Identifier field used to retrieve, update,


sort a record
BBFE 21342– Management Information Syste 10
ms
Organizing Data in a Traditional File
Environment

The Data Hierarchy

BBFE 21342– Management Information Syste 11


ms
Problems with the Traditional File
Environment

Data Redundancy and Inconsistency:

• Data redundancy: The presence of duplicate data


in multiple data files so that the same data are
stored in more than one place or location

• Data inconsistency: The same attribute may have


different values.

BBFE 21342– Management Information Syste 12


ms
Problems with the Traditional File
Environment

Program-data dependence:

• The coupling of data stored in files and the specific programs


required to update and maintain those files such that changes
in programs require changes to the data

Lack of flexibility:

• A traditional file system can deliver routine scheduled reports


after extensive programming efforts, but it cannot deliver ad-
hoc reports or respond to unanticipated information
requirements in a timely fashion.
BBFE 21342– Management Information Syste 13
ms
Problems with the Traditional File
Environment

Poor security:
• Because there is little control or management of data, management
will have no knowledge of who is accessing or even making
changes to the organization’s data.
Lack of data sharing and availability:
• Information cannot flow freely across different functional areas or
different parts of the organization. Users find different values of the
same piece of information in two different systems, and hence they
may not use these systems because they cannot trust the accuracy
of the data.

BBFE 21342– Management Information Syste 14


ms
Organizing Data in a
Traditional File Environment

Traditional File Processing

BBFE 21342– Management Information Syste 15


ms
The Database Approach to Data
Management
Database Management System (DBMS)
• Software for creating and maintaining databases

• Permits firms to rationally manage data for the


entire firm

• Acts as interface between application programs


and physical data files

• Separates logical and design views of data

• Solves many problems of the traditional data file


approach BBFE 21342– Management Information Syste 16
ms
The Database Approach to Data
Management
The Contemporary Database Environment

BBFE 21342– Management Information Syste 17


ms
The Database Approach to Data
Management

Types of Databases:

• Relational DBMS

• Hierarchical and network DBMS

• Object-oriented databases

BBFE 21342– Management Information Syste 18


ms
The Database Approach to Data
Management

Relational DBMS:

• Represents data as two-dimensional tables called


relations

• Relates data across tables based on common


data element

• Examples: DB2, Oracle, MS SQL Server

BBFE 21342– Management Information Syste 19


ms
The Database Approach to
Data Management
The Relational Data Model

BBFE 21342– Management Information Syste 20


ms
The Relational Data Model

Let’s examine some basic principles about how data are stored in
computer systems.
– An entity is anything about which the organization wishes to store data. At your
college or university, one entity would be the student.

STUDENTS

Phone
Student ID Last 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

123-45-6789 Moore Artie 555-5555 04/20/85

BBFE 21342– Management Information Syste 21


ms
The Relational Data Model

– Informationabout the attributes of an entity (e.g., the student’s


ID number and birth date) are stored in fields.

STUDENTS

Phone
Student ID Last 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

123-45-6789 Moore Artie 555-5555 04/20/85

22 of 95

BBFE 21342– Management Information Syste 22


ms
The Relational Data Model

– All the fields containing data about one entity (e.g.,


one student) form a record.
– The example below shows the record for Artie Moore.

STUDENTS

Phone
Student ID Last 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

123-45-6789 Moore Artie 555-5555 04/20/85

BBFE 21342– Management Information Syste 23


ms
The Relational Data Model

– A set of all related records forms a file (e.g., the student file).
– If this university only had three students and five fields for each
student, then the entire file would be depicted below.

STUDENTS

Phone
Student ID Last 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

123-45-6789 Moore Artie 555-5555 04/20/85


BBFE 21342– Management Information Syste 24
ms
The Relational Data Model

– A set of interrelated, centrally coordinated files forms a


database.

Student Class
File File

Advisor
File
BBFE 21342– Management Information Syste 25
ms
Importance and Advantages of Database
Systems

• Database technology provides the following


benefits to organizations:
• Achieved by combining master
– Data integration files into larger pools of data
accessible by many programs.

BBFE 21342– Management Information Syste 26


ms
Importance and Advantages of Database
Systems

• Database technology provides the following


benefits to organizations:
– Data integration
• It’s easier to share data that’s
– Data sharing integrated.

BBFE 21342– Management Information Syste 27


ms
Importance and Advantages of Database
Systems

• Database technology provides the following


benefits to organizations:
– Data integration
– Data sharing
– Reporting flexibility
• Reports can be revised easily and generated as
needed.
• The database can easily be browsed to research
problems or obtain detailed information.

BBFE 21342– Management Information Syste 28


ms
Importance and Advantages of Database
Systems

• Database technology provides the following benefits to


organizations:
– Data integration
– Data sharing
– Reporting flexibility
– Minimal data redundancy and
inconsistencies • Because data items are usually
stored only once.

BBFE 21342– Management Information Syste 29


ms
Importance and Advantages of Database
Systems

• Database technology provides the following


benefits to organizations:
– Data int
egration
Data items are independent of the programs that
use them.
– Data sh
aringConsequently, a data item can be changed without changing

– Reporti
ng flexibility
the program and vice versa.
Makes programming easier and simplifies data management.
– Minimal
data redundancy and inconsistencies
– Data independence

BBFE 21342– Management Information Syste 30


ms
Importance and Advantages of Database
Systems

• Database technology provides the following


benefits to organizations:
– Data integration
– Data sharing

– Reporting fl
exibility
Data management is more efficient because the database
administrator is responsible for coordinating, controlling,
– Minimal dat a redundancy and inconsistencies ndence
and managing data.
– Data indepe
– Central management of data

BBFE 21342– Management Information Syste 31


ms
Importance and Advantages of Database
Systems

• Database technology provides the following benefits to


organizations:
– Data integration
– Data sharing
– Reporting flexibility
– Minimal d Relationships
ata can be explicitly defined and used in the
redundancy and inconsistencies
preparation of management reports.
– Data inde EXAMPLE:
pendence anagement of data
Relationship between selling costs and promotional
– Central m campaigns.

– Cross-functional analysis

BBFE 21342– Management Information Syste 32


ms
Database Systems

• Logical and Physical Views of Data


– In file-oriented systems, programmers must
know the physical location and layout of
records used by a program.
• They must reference the location, length, and
format of every field they utilize.
• When data is used from several files, this process
becomes more complex.

BBFE 21342– Management Information Syste 33


ms
Database Systems

• Database systems overcome this problem by


separating the storage and use of data
elements.
– Two separate views of the data are provided:
• Logical view
 How the user or programmer conceptually
organizes and understands the data.

• Physical view
 How and where the data are physically
arranged and stored.
BBFE 21342– Management Information Syste 34
ms
Database Systems

• Database systems overcome this problem by


separating the storage and use of data elements.
– Two separate views of the data are provided:
• Logical view
• Physical view
– Separating these views facilitates application
development, because programmers can
focus on coding the logic and not be
concerned with storage details.

BBFE 21342– Management Information Syste 35


ms
Logical View—User A Logical View—User B
Enrollment by Class Scholarship Distribution
Fr.
5%
Sr. Soph.
33% 24%

Jr.
38%

The DBMS translates


DBMS users’ logical views
into instructions as to
which data should be
Operating retrieved from the
System database.

Database
BBFE 21342– Management Information Syste 36
ms
Logical View—User A Logical View—User B
Enrollment by Class Scholarship Distribution
Fr.
5%
Sr. Soph.
33% 24%

Jr.
38%

DBMS
The operating system
Operating translates DBMS
System requests into
instructions to
physically retrieve
data from various
Database disks.

BBFE 21342– Management Information Syste 37


ms
Database Systems

• The DBMS handles the link between the


physical and logical views of the data.
– Allows the user to access, query, and update data
without reference to how or where it is
physically stored.
– The user only needs to define the logical data
requirements.

BBFE 21342– Management Information Syste 38


ms
Database Systems

• Separating the logical and physical views of data


also means users can change their conceptualizations
of the data relationships without making changes in
the physical storage.
• The database administrator can also change the
physical storage of the data without affecting users
or application programs.

BBFE 21342– Management Information Syste 39


ms
Database Systems

• Schemas
– A schema describes the logical structure of a database.
– There are three levels of schema.
• Conceptual level

•The organization-wide view of the entire


database—i.e., the big picture.
•Lists all data elements and the relationships between
them.

BBFE 21342– Management Information Syste 40


ms
Subschema--User A Subschema--User B Subschema--User C
Smith . . . A
Jones . . . B

Arnold . . .D

Mapping external-level views to conceptual-level schema

Classes Enroll Student

Cash
Receipt

Mapping conceptual-level items to internal-level descriptions

Student Record Class Record


Student No. --character [9] Class Name --character [9]
Student Name --character [26] Dept No. --integer [4], non-null, index=itemx
SAT Score --integer [2], non-null, index=itemx Course No. --integer [4], non-null, index=itemx
BBFE 21342– Management Information Syste 41
ms
Database Systems

• Schemas
– A schema describes the logical structure of a
database.
– There are three levels of schema.
• Conceptual level
• External level
• A set of individual user views of portions of
the database, i.e., how each user sees the
portion of the system with which he
interacts.
• These individual views are referred to as
subschema.
BBFE 21342– Management Information Syste 42
ms
Subschema--User A Subschema--User B Subschema--User C
Smith . . . A
Jones . . . B

Arnold . . .D

Mapping external-level views to conceptual-level schema

Classes Enroll Student

Cash
Receipt

Mapping conceptual-level items to internal-level descriptions

Student Record Class Record


Student No. --character [9] Class Name --character [9]
Student Name --character [26] Dept No. --integer [4], non-null, index=itemx
SAT Score --integer [2], non-null, index=itemx Course No. --integer [4], non-null, index=itemx
BBFE 21342– Management Information Syste 43
ms
Database Systems

• Schemas
– A schema describes the logical structure of a
database.
– There are three levels of schema.
• Conceptual level• A low-level view of the database.
• External level • It describes how the data are actually
stored and accessed including:
• Internal level – Record layouts
– Definitions
– Addresses
– Indexes
BBFE 21342– Management Information Syste 44
ms
Subschema--User A Subschema--User B Subschema--User C
Smith . . . A
Jones . . . B

Arnold . . .D

Mapping external-level views to conceptual-level schema

Classes Enroll Student

Cash
Receipt

Mapping conceptual-level items to internal-level descriptions

Student Record Class Record


Student No. --character [9] Class Name --character [9]
Student Name --character [26] Dept No. --integer [4], non-null, index=itemx
SAT Score --integer [2], non-null, index=itemx Course No. --integer [4], non-null, index=itemx
BBFE 21342– Management Information Syste 45
ms
Subschema--User A Subschema--User B Subschema--User C
Smith . . . A
Jones . . . B

Arnold . . .D

Mapping external-level views to conceptual-level schema

The
Classes Enroll Student bidirectional
arrows
represent
mappings
Cash
between the
Receipt
schema.

Mapping conceptual-level items to internal-level descriptions

Student Record Class Record


Student No. --character [9] Class Name --character [9]
Student Name --character [26] Dept No. --integer [4], non-null, index=itemx
SAT Score --integer [2], non-null, index=itemx Course No. --integer [4], non-null, index=itemx
BBFE 21342– Management Information Syste 46
ms
Database Systems

• The DBMS uses the mappings to translate a


request by a user or program for data
(expressed in logical names and relationships)
into the indexes and addresses needed to
physically access the data.

BBFE 21342– Management Information Syste 47


ms
Database Systems

• The Data Dictionary


– A key component of a DBMS is the data
dictionary.
• Contains information about the structure of the
database.
• For each data element, there is a corresponding
record in the data dictionary describing that
element.

BBFE 21342– Management Information Syste 48


ms
Database Systems

• Information provided for each element includes:


– A description or explanation of the element.
– The records in which it is contained.
– Its source.
– The length and type of the field in which it is stored.
– The programs in which it is used.
– The outputs in which it is contained.
– The authorized users of the element.
– Other names for the element.
BBFE 21342– Management Information Syste 49
ms
Database Systems

• The DBMS usually maintains the data dictionary.


– It is often one of the first applications of a newly
implemented database system.
– Inputs to the dictionary include:
• Records of new or deleted data elements.
• Changes in names, descriptions, or uses of existing
elements.
– Outputs include:
• Reports that are useful to programmers, database designers, and IS
users in:
– Designing and implementing the system.
– Documenting the system.
– Creating an audit trail.
BBFE 21342– Management Information Syste 50
ms
Database Systems

• DBMS Languages
– Every DBMS must provide a means of
performing the three basic functions of:
• Creating a database
• Changing a database
• Querying a database

BBFE 21342– Management Information Syste 51


ms
Database Systems

• Creating a database:
– The set of commands used to create the
database is known as data definition
language (DDL). DDL is used to:
• Build the data dictionary
• Initialize or create the database
• Describe the logical views for each individual user or
programmer
• Specify any limitations or constraints on security
imposed on database records or fields
BBFE 21342– Management Information Syste 52
ms
Database Systems

• Changing a database
– The set of commands used to change the
database is known as data manipulation
language (DML). DML is used for
maintaining the data including:
• Updating data
• Inserting data
• Deleting portions of the database

BBFE 21342– Management Information Syste 53


ms
Database Systems

• Querying a database:
– The set of commands used to query the database is known
as data query language (DQL). DQL is
used to interrogate the database, including:
• Retrieving records
• Sorting records
• Ordering records
• Presenting subsets of the database
– The DQL usually contains easy-to-use, powerful
commands that enable users to satisfy their own
information needs.
BBFE 21342– Management Information Syste 54
ms
Database Systems

• Report Writer
– Many DBMS packages also include a report writer, a
language that simplifies the creation of reports.
– Users typically specify:
• What elements they want printed
• How the report should be formatted
– The report writer then:
• Searches the database
• Extracts specified data
• Prints them out according to specified format

BBFE 21342– Management Information Syste 55


ms
Database Systems

• Users typically have access to both DQL and


report writer.
• Access to DDL and DML are typically restricted to
employees with administrative and programming
responsibilities.

BBFE 21342– Management Information Syste 56


ms
Database Systems

• A DBMS is characterized by the type of


logical data model on which it is based.
– A data model is an abstract representation of
the contents of a database.
– Most new DBMSs are called relational
databases because they use the relational
model developed by E.F. Codd in 1970.

BBFE 21342– Management Information Syste 57


ms
Relational Databases

• The relational data model represents


everything in the database as being stored in
the forms of tables (aka, relations).

BBFE 21342– Management Information Syste 58


ms
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333 Relation
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

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 x COURSE
SCID Student ID Course
333333333-1234 333-33-3333 1234
333333333-1236 333-33-3333 1236
111111111-1235 111-11-1111 1235
111111111-1236 111-11-1111 1235
BBFE 21342– Management Information Syste 59
ms
Relational Databases

• This model only describes how the data


appear in the conceptual- and external-
level schemas.
• The data are physically stored according to
the description in the internal-level schema.

BBFE 21342– Management Information Syste 60


ms
STUDENTS
Each row is
Last First Phone
called a tuple,
Student ID Name Name No.
which rhymes
333-33-3333 Simpson Alice 333-3333
with “couple.”
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

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 x
COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236 BBFE 21342– Management Information Syste 61
ms
STUDENTS Each row
Last First Phone
contains data
Student ID Name Name No. about a specific
occurrence of
333-33-3333 Simpson Alice 333-3333
the type of entity
111-11-1111 Sanders Ned 444-4444
in the table.
123-45-6789 Moore Artie 555-5555

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 x
COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236 BBFE 21342– Management Information Syste
ms
62
STUDENTS Each column in
Last First Phone a table
Student ID Name Name No. contains
333-33-3333 Simpson Alice 333-3333 information
111-11-1111 Sanders Ned 444-4444 about a specific
123-45-6789 Moore Artie 555-5555 attribute of the
entity.
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 x
COURSE
SCID
333333333-1234
333333333-1236
111111111-1235
111111111-1236 BBFE 21342– Management Information Syste
ms
63
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

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 x
COURSE A primary key is the
SCID attribute or combination
333333333-1234 of attributes that
333333333-1236 uniquely identifies a
specific row in a table.
111111111-1235
111111111-1236 BBFE 21342– Management Information Syste
ms
64
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

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 x COURSE
SCID
333333333-1234 In some tables, two or more attributes
333333333-1236 may be joined to form the primary key.
111111111-1235
111111111-1236
BBFE 21342– Management Information Syste 65
ms
STUDENTS
Advisor
Student ID Last Name First 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

ADVISORS
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

A foreign key is an attribute in one table that is a primary key in


another table.

BBFE 21342– Management Information Syste 66


ms
STUDENTS
Advisor
Student ID Last Name First 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

ADVISORS
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

Foreign keys are used to link tables together.

BBFE 21342– Management Information Syste 67


ms
STUDENTS
Advisor
Student ID Last Name First 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

ADVISORS
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

Other non-key attributes in each table store important


information about the entity.

BBFE 21342– Management Information Syste 68


ms
Relational Databases

• Alternatives for Storing Data


– One possible alternate approach would be to
store all data in one uniform table.
– For example, instead of separate tables for
students and classes, we could store all data in
one table and have a separate line for each student
x class combination.

BBFE 21342– Management Information Syste 69


ms
Last First Sectio
Student ID Name Name Phone No. Course No. n Day Time
333-33-3333 Simpson Alice 333-3333 ACCT-3603 1 M 9:00 AM
333-33-3333 Simpson Alice 333-3333 FIN-3213 3 Th 11:00 AM
333-33-3333 Simpson Alice 333-3333 MGMT-3021 11 TH 12:00 PM
111-11-1111 Sanders Ned 444-4444 ACCT-3433 2 T 10:00 AM
111-11-1111 Sanders Ned 444-4444 MGMT-3021 5 W 8:00 AM
111-11-1111 Sanders Ned 444-4444 ANSI-1422 7 F 9:00 AM
123-45-6789 Moore Artie 555-5555 ACCT-3433 2 T 10:00 AM
123-45-6789 Moore Artie 555-5555 FIN-3213 3 Th 11:00 AM

• Using the suggested approach, a student taking three classes


would need three rows in the table.
• In the above, simplified example, a number of problems arise.

BBFE 21342– Management Information Syste 70


ms
Last First
Student ID Name Name Phone No. Course No. Sect. Day Time
333-33-3333 Simpson Alice 333-3333 ACCT-3603 1 M 9:00 AM
333-33-3333 Simpson Alice 333-3333 FIN-3213 3 Th 11:00 AM
333-33-3333 Simpson Alice 333-3333 MGMT-3021 11 TH 12:00 PM
111-11-1111 Sanders Ned 444-4444 ACCT-3433 2 T 10:00 AM
111-11-1111 Sanders Ned 444-4444 MGMT-3021 5 W 8:00 AM
111-11-1111 Sanders Ned 444-4444 ANSI-1422 7 F 9:00 AM
123-45-6789 Moore Artie 555-5555 ACCT-3433 2 T 10:00 AM
123-45-6789 Moore Artie 555-5555 FIN-3213 3 Th 11:00 AM

• Suppose Alice Simpson changes her phone number. You need


to make the change in three places. If you fail to change it in all
three places or change it incorrectly in one place, then the
records for Alice will be inconsistent.
• This problem is referred to as an update anomaly.

BBFE 21342– Management Information Syste 71


ms
Last First
Student ID Name Name Phone No. Course No. Sect. Day Time
333-33-3333 Simpson Alice 333-3333 ACCT-3603 1 M 9:00 AM
333-33-3333 Simpson Alice 333-3333 FIN-3213 3 Th 11:00 AM
333-33-3333 Simpson Alice 333-3333 MGMT-3021 11 TH 12:00 PM
111-11-1111 Sanders Ned 444-4444 ACCT-3433 2 T 10:00 AM
111-11-1111 Sanders Ned 444-4444 MGMT-3021 5 W 8:00 AM
111-11-1111 Sanders Ned 444-4444 ANSI-1422 7 F 9:00 AM
123-45-6789 Moore Artie 555-5555 ACCT-3433 2 T 10:00 AM
123-45-6789 Moore Artie 555-5555 FIN-3213 3 Th 11:00 AM

• What happens if you have a new student to add, but he hasn’t


signed up for any courses yet?
• Or what if there is a new class to add, but there are no students
enrolled in it yet? In either case, the record will be partially
blank.
• This problem is referred to as an insert anomaly.
BBFE 21342– Management Information Syste 72
ms 69 of 95
Last First
Student ID Name Name Phone No. Course No. Sect. Day Time
333-33-3333 Simpson Alice 333-3333 ACCT-3603 1 M 9:00 AM
333-33-3333 Simpson Alice 333-3333 FIN-3213 3 Th 11:00 AM
333-33-3333 Simpson Alice 333-3333 MGMT-3021 11 TH 12:00 PM
111-11-1111 Sanders Ned 444-4444 ACCT-3433 2 T 10:00 AM
111-11-1111 Sanders Ned 444-4444 MGMT-3021 5 W 8:00 AM
111-11-1111 Sanders Ned 444-4444 ANSI-1422 7 F 9:00 AM
123-45-6789 Moore Artie 555-5555 ACCT-3433 2 T 10:00 AM
123-45-6789 Moore Artie 555-5555 FIN-3213 3 Th 11:00 AM

• 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.

BBFE 21342– Management Information Syste 73


ms
Relational Databases

• Alternatives for Storing Data


– Another possible approach would be to store
each student in one row of the table and create
multiple columns to accommodate each class
that he is taking.

BBFE 21342– Management Information Syste 74


ms
Last First Phone
Student ID0 Name Name No. Class 1 Class 2 Class 3 Class 4

333-33-3333 Simpson Alice 333-3333 ACCT-3603 FIN-3213 MGMT-3021

111-11-1111 Sanders Ned 444-4444 ACCT-3433 MGMT-3021 ANSI-1422

123-45-6789 Moore Artie 555-5555 ACCT-3433 FIN-3213

• This approach is also fraught with problems:


– How many classes should you allow for in building the table?
– The above table is quite simplified. In reality, you might
need to allow for 20 or more classes (assuming a student
could take many 1-hour classes). Also, more information
than just the course number would be stored for each class.
There would be a great deal of wasted space for all the
students taking fewer than the maximum possible number of
classes.
– Also, if you wanted a list of every student taking MGMT-3021,
notice that you would have to search multiple attributes.
BBFE 21342– Management Information Syste 75
ms
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

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 x • The solution to the preceding problems
COURSE
is to use a set of tables in a relational
SCID
database.
333333333-1234
• Each entity is stored in a separate table,
333333333-1236
and separate tables or foreign keys can
111111111-1235 be used to link the entities together.
111111111-1236 BBFE 21342– Management Information Syste 76
ms
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 classes.

BBFE 21342– Management Information Syste 77


ms
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.

BBFE 21342– Management Information Syste 78


ms
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

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 x
COURSE
• Note that within each table, there are no
SCID
duplicate primary keys and no null
333333333-1234 primary keys.
333333333-1236
• Consistent with the entity integrity rule.
111111111-1235
111111111-1236 BBFE 21342– Management Information Syste 79
ms
Relational Databases

• Basic Requirements of a Relational


Database
– A foreign key must either be null or
correspond to the value of a primary key in
another table.
• This rule is referred to as the referential integrity
rule.
• The rule is necessary because foreign keys are used
to link rows in one table to rows in another table.

BBFE 21342– Management Information Syste 80


ms
STUDENTS
Advisor
Student ID Last Name First 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

ADVISORS
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

Advisor No. is a foreign key in the STUDENTS table. Every


incident of Advisor No. in the STUDENTS table either matches
an instance of the primary key in the ADVISORS table or is null.

BBFE 21342– Management Information Syste 81


ms
Relational Databases

• Basic Requirements of a Relational


Database
– All non-key attributes in a table should
describe a characteristic of the object
identified by the primary key.
• Could nationality be a non-key attribute in the
student table?
• Could advisor’s nationality be a non-key attribute
in the student table?

BBFE 21342– Management Information Syste 82


ms
Relational Databases

• The preceding four constraints produce a well-


structured (normalized) database in which:
– Data are consistent.
– Redundancy is minimized and controlled.
• In a normalized database, attributes appear multiple
times only when they function as foreign keys.
• The referential integrity rule ensures there will be no
update anomaly problem with foreign keys.

BBFE 21342– Management Information Syste 83


ms
Relational Databases

• An important feature is that data about various things of


interest (entities) are stored in separate tables.
– Makes it easier to add new data to the system.
• You add a new student by adding a row to the student
table.
• You add a new course by adding a row to the course
table.
• Means you can add a student even if he hasn’t signed up
for any courses.
• And you can add a class even if no students are yet
enrolled in it.
– Makes it easy to avoid the insert anomaly.
Space is also used more efficiently than in the other
schemes. There should be no blank rows or attributes.
BBFE 21342– Management Information Syste 84
ms
• Add a
STUDENTS
student
Last First Phone
Student ID Name Name No.
here.
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 x
COURSE • Add a course here.
SCID • Leaves no blank spaces.
333333333-1234
333333333-1236 • When a particular student enrolls for a
111111111-1235 particular course, add that info here.
111111111-1236 BBFE 21342– Management Information Syste 85
ms
Relational Databases

• Deletion of a class for a student would cause


the elimination of one record in the student x
class table.
– The student still exists in the student table.
– The class still exists in the class table.
– Avoids the delete anomaly.

BBFE 21342– Management Information Syste 86


ms
STUDENTS
Last First Phone • Ned still
Student ID Name Name No. exists
333-33-3333 Simpson Alice 333-3333 in 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 x
COURSE • Even if Ned was the only student in
SCID the class, ACCT-3603 still exists in
333333333-1234 the course table.
333333333-1236
• If Ned Sanders drops ACCT-3603,
111111111-1235
remove Ned’s class from this table.
111111111-1236 BBFE 21342– Management Information Syste 87
ms
Creating a Database Environment

Designing Databases:

• Conceptual design: Abstract model of database


from a business perspective

• Physical design: Detailed description of business


information needs

BBFE 21342– Management Information Syste 88


ms
Creating a Database Environment

Designing Databases: (Continued)

• Entity-relationship diagram: Methodology for


documenting databases illustrating relationships
between database entities

• Normalization: Process of creating small stable


data structures from complex groups of data

BBFE 21342– Management Information Syste 89


ms
Entity Relationship
Modelling

BBFE 21342– Management Information Syste 90


ms
E-R Data Modelling

An entity is an object that exists and


Example: specific person, company,
is distinguishable from other event, plant
objects.

Example: people have names and


Entities have attributes addresses

An entity set is a set of entities of


Example: set of all persons, companies,
the same type that share the same trees, holidays
properties.

BBFE 21342– Management Information Syste 91


ms
Attributes

• An entity is represented by a set of attributes, that is


descriptive properties
• possessed by all members of an entity set.
• Example:
• instructor = (ID, name, street, city, salary )
• course= (course_id, title, credits)
• Domain – the set of permitted values for each attribute
• Attribute types:
• Simple and composite attributes.
• Single-valued and multivalued attributes
• Derived attributes

BBFE 21342– Management Information Syste 92


ms
Types of Attributes

Simple Attribute: Attribute that consist of a single atomic value.


Example: Salary

Composite Attribute : Attribute value not atomic.


Example : Address : ‘House _no:City:State
Name : ‘First Name: Middle Name: Last Name’

BBFE 21342– Management Information Syste 93


ms
Types of Attributes

Single Valued Attribute: Attribute that hold a single value

Exampe1: City
Example2:Customer id

Multi Valued Attribute: Attribute that


hold multiple values.

Example1: A customer can have multiple phone numbers, email id's


etc Example2: A person may have several college degrees

Derived Attribute: An attribute that’s value is derived from a stored


attribute.

Example : age, and its value is derived from the stored attribute Date
of Birth. BBFE 21342– Management Information Syste 94
ms
Entity Sets INSTRUCTOR and STUDENT

instructor_ID instructor_name student-ID student_name

BBFE 21342– Management Information Syste 95


ms
Relationship Sets

 A relationship is an association among several


entities
Example:
advisor 22222 (Einstein)
44553 (Peltier) instructor entity
student entity relationship set

BBFE 21342– Management Information Syste 96


ms
Entity-Relationship Diagrams

 Representing entities
we represent an entity by a named rectangle
use a singular noun, or adjective + noun
refer to one instance in naming

BBFE 21342– Management Information Syste 97


ms
Entity-Relationship Diagrams

 Representing relationship

BBFE 21342– Management Information Syste 98


ms
Entity-Relationship Diagrams

 Types of Relationships
 Three types of relationships can exist between entities

 One-to-one relationship (1:1): One instance in an entity (parent)


refers to one and only one instance in the related entity (child).

 One-to-many relationship (1:M): One instance in an entity


(parent) refers to one or more instances in the related entity
(child)

BBFE 21342– Management Information Syste 99


ms
Entity-Relationship Diagrams

One to one One to many

BBFE 21342– Management Information Syste 100


ms
Entity-Relationship Diagrams

 Types of Relationships
 Many-to-many relationship (M:N): exists when one instance of the first entity
(parent) can relate to many instances of the second entity (child), and one
instance of the second entity can relate to many instances of the first entity.

Many to many
BBFE 21342– Management Information Syste 101
ms
Cardinality Constraints

 We express cardinality constraints by drawing either a directed line (),


signifying “one,” or an undirected line (—), signifying “many,” between
the relationship set and the entity set.
 Or, by numbering each entity. * or, m for many.

 One-to-one relationship:
 A student is associated with at most one instructor via the
relationship advisor
 A student is associated with at most one department via
stud_dept

1 1

BBFE 21342– Management Information Syste 102


ms
Many-to-Many Relationship

 An instructor is associated with several (possibly 0) students via


advisor
 A student is associated with several (possibly 0) instructors via
advisor

1 1

BBFE 21342– Management Information Syste 103


ms
E-R Diagrams

 Crow’s foot notation: A type of cardinality notation. It is


called crow's foot notation because of the shapes, which
include circles, bars, and symbols, that indicate various
possibilities.

A single bar indicates one, a double bar indicates one


and only one, a circle indicates zero, and a crow's foot
indicates many.
1 1

BBFE 21342– Management Information Syste 104


ms
E-R Diagrams

1 1

Crow's foot notation is a common method of indicating cardinality. The four


examples show how you can use various symbols to describe the relationships
between entities.
BBFE 21342– Management Information Syste 105
ms
Different Types of Keys

 A candidate key of an entity set is a minimal super key


 ID is candidate key of instructor
 course_id is candidate key of course

BBFE 21342– Management Information Syste 106


ms
Primary Key

 A primary key is a candidate key that is most appropriate to be the main


reference key for the table. As its name suggests, it is the primary key of
reference for the table and is used throughout the database to help establish
relationships with other tables.
 The primary key must contain unique values, must never be null and
uniquely identify each record in the table

BBFE 21342– Management Information Syste 107


ms
Foreign Key

 A foreign key is generally a primary key from one table that appears as a field in
another where the first table has a relationship to the second. In other words, if
we had a table A with a primary key X that linked to a table B where X was a field
in B, then X would be a foreign key in B

BBFE 21342– Management Information Syste 108


ms
Different Types of Keys

A super key of an entity set is a set of one or more attributes whose


values uniquely determine each entity.
Example:

 {Student ID,FirstName }
 {Student ID, LastName }

 {Student ID,FirstName,LastName}

BBFE 21342– Management Information Syste 109


ms
E-R Diagrams

 Rectangles represent entity sets.


 Diamonds represent relationship sets.
 Attributes listed inside entity rectangle. Or , as oval shape along
with the
rectangle.
 Underline indicates primary key attributes

BBFE 21342– Management Information Syste 110


ms
Summary of Symbols Used in E-R Notation

BBFE 21342– Management Information Syste 111


ms
Total Participation of Entity Set

 E.g., A Class entity cannot exist unless related to a Faculty member


entity

BBFE 21342– Management Information Syste 112


ms
Weak Entity Sets

An entity set that does not have a primary key is referred to as a weak entity set

 We underline the discriminator of a weak entity set with a


dashed line.
 We put the identifying relationship of a weak entity in a double
diamond.
 Primary key for section – (course_id, sec_id, semester, year)

BBFE 21342– Management Information Syste 113


ms
Summary of Symbols Used in E-R Notation

Crows feet notation

BBFE 21342– Management Information Syste 114


ms
Summary of Symbols Used in E-R Notation

 Representing attributes

 Rectangle -- Entity

 Ellipses -- Attribute (underlined attributes are [part of] the primary key)

 Double ellipses -- multi-valued attribute

 Dashed ellipses-- derived attribute, e.g. age is derivable from birthdate and
current date. BBFE 21342– Management Information Syste 115
ms
Summary of Symbols Used in E-R Notation

 Representing attributes

BBFE 21342– Management Information Syste 116


ms
E-R Diagram for a University

BBFE 21342– Management Information Syste 117


ms

You might also like