0% found this document useful (0 votes)
50 views7 pages

Relational Data Base Chapter Five

Uploaded by

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

Relational Data Base Chapter Five

Uploaded by

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

Chapter five

Relational Databases

What Is a Database?

 Efficiently and centrally coordinates information for a related group of files


 A file is a related group of records
 A record is a related group of fields
 A field is a specific attribute of interest for the entity (record)

Advantages of Databases

 Data is integrated and easy to share


 Minimize data redundancy
 Data is easily accessed for reporting and cross functional analysis

Database Users and Designers

 Different users of the database information are at an external level of the database. These
users have logical views of the data.
 At an internal level of the database is the physical view of the data which is how the data
is actually physically stored in the system.

1
 Designers of a database need to understand user’s needs and the conceptual level of the
entire database as well as the physical view.
Database Design
 To design a database, you need to have a conceptual view of the entire database. The
conceptual view illustrates the different files and relationships between the files.
 The data dictionary is a “blueprint” of the structure of the database and includes data
elements, field types, programs that use the data element, outputs, and so on
DBMS Languages
Data Definition Language (DDL)
 Builds the data dictionary
 Creates the database
 Describes logical views for each user
Data Manipulation Language (DML)
 Changes the content in the database
 Creates, updates, insertions, and deletions
Data Query Language (DQL)
 Enables users to retrieve, sort, and display specific data from the database
Relational Database
 Represents the conceptual and external schema as if that “data view” were truly stored in
one table.
 Although the conceptual view appears to the user that this information is in one big
table, it is really a set of tables that relate to one another
Conceptual view example
Customer Name Sales Invoice# Invoice Total
D. Ainge 101 $1,447
G. Kite 102 $4,394
D. Ainge 103 $898
G. Kite 104 $789
F. Roberts 105 $3,994

2
Relational Data Tables

Primary
Keys Foreign (Customer # is a
key
Key in the Foreign
Sales Table because
Prima
it is a key that uniquely
Customers
ry in the
identifies Customer
Because
Table). of this, the Sales Table can
to the Customer Table (see red
relate
above
arrow
).
Why Have a Set of Related Tables?
Data stored in one large table can be redundant and inefficient causing the following problems:
 Update anomaly
 Insert anomaly
 Delete anomaly

3
Relational Database Design Rules

 Every column in a row must be single valued


 Primary key cannot be null (empty) also known as entity integrity
 IF a foreign key is not null, it must have a value that corresponds to the value of a
primary key in another table (referential integrity)
 All other attributes in the table must describe characteristics of the object identified by
the primary key

Following these rules allows databases to be normalized and solves the update, insert, and delete
anomalies.

Queries
 Users may want specific information found in a relational database and not have to sort
through all the files to get that information. So they query (ask a question) the data.
 An example of a query might be: What are the invoices of customer D. Ainge and who
was the salesperson for those invoices?

Creating the Query

4
Query Answer

Database Design Using the REA Data Model

Database Design Process

5
Data Modeling

 Process of defining a database so that it faithfully represents all aspects of the


organization, including its interactions with the external environment.
 Entity-relationship (E-R) diagrams
 REA data model

REA Modeling
Resources
 Things that have economic value to the organization (e.g., inventory, cash)
Events
 Various business activities that management wants to collect information on
Agents
 People and organizations that participate in events (both internal (e.g., employees) and
external (e.g., customers/vendors) to the organization
REA Basic Template

Creating an REA Model


 Identify relevant events :-Give-get exchange (economic duality)

6
 Identify resources and agents
Resource reduced in give event
Resource acquired in get event
 Determine cardinalities of relationships
Nature of the relationship between the two entities

You might also like