Week7 CM MDL CC225
Week7 CM MDL CC225
Learning Outcomes:
After completing this course you are expected to demonstrate the following:
1. Explain the advantages of relational model and rules for fully relational systems. It
also familiarize the learner with earlier database models.
A. Engage
BUBBLE ORGANIZER
Instruction: Using the bubble organizer, define the meaning of such word situated inside the
bubbles.
RELATIONAL
Figure 7.0
B. Explore
C. Explain
As previously discusses, relational model was proposed by E. F. Codd in 1970 and
consists of the following three components: (a) a data structure for building the database, (b)
data manipulation which is a collection of operators that may be used to retrieve, derive or
modify data stored in the database and (c) data integrity which is a collection of rules that
implicitly or explicitly define a consistent database state or changes of states.
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 1 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
D. Elaborate
Introduction
In the relational model, data are structured into tables (i.e., "relations") consisting of
rows and columns. Each row contains a single record comprised of individual data elements (or
"attributes") organized in columns containing elements of the same kind according to the rules
defined for that column. Alternate database models include the network and hierarchical.
Codd in his 1970 paper indicated that there were four major objectives in designing the
relational data model.
Data Independence - to provide a sharp and clear boundary between the logical and
physical aspects of database management.
Simplicity - to provide a simpler structure than were being used at that time. A simple
structure is easy to communicate to users and programmers and a wide variety of users
can interact with a simple model.
Set-processing - to provide facilities for manipulating a set of records at a time so that
programmers are not operating on the database record by record.
Sound Theoretical Background - to provide a theoretical background for database
management field.
Dr. Edgar Frank Codd (August 19, 1923 – April 18, 2003) was a computer scientist while
working for IBM he invented the relational model for database management (theoretical basis
for relational databases). Codd proposed thirteen rules (numbered zero to twelve) and said that
if a Database Management System meets these rules, it can be called as a Relational Database
Management System. These rules are called as Codd's 12 rules. Hardly any commercial product
follows all.
Rule Zero
The system must qualify as relational, as a database, and as a management system. For a
system to qualify as a relational database management system (RDBMS), that system must use
its relational facilities (exclusively) to manage the database.
The other 12 rules derive from this rule. The rules are as follows:
Rule 1: The information rule: All information in the database is to be represented in one and
only one way, namely by values in column positions within rows of tables.
Rule 2: The guaranteed access rule: All data must be accessible. This rule is essentially a
restatement of the fundamental requirement for primary keys. It says that every individual
scalar value in the database must be logically addressable by specifying the name of the
containing table, the name of the containing column and the primary key value of the
containing row.
Rule 3: Systematic treatment of null values: The DBMS must allow each field to remain null (or
empty). Specifically, it must support a representation of "missing information and inapplicable
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 2 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
information" that is systematic, distinct from all regular values (for example, "distinct from zero
or any other number", in the case of numeric values), and independent of data type. It is also
implied that such representations must be manipulated by the DBMS in a systematic way.
Rule 4: Active online catalog based on the relational model: The system must support an online,
inline, relational catalog that is accessible to authorized users by means of their regular query
language. That is, users must be able to access the database's structure (catalog) using the
same query language that they use to access the database's data.
Rule 5: The comprehensive data sub language rule: The system must support at least one
relational language that
1. Has a linear syntax
2. Can be used both interactively and within application programs,
3. Supports data definition operations (including view definitions), data manipulation
operations (update as well as retrieval), security and integrity constraints, and
transaction management operations (begin, commit, and rollback).
Rule 6: The view updating rule: All views those can be updated theoretically, must be updated
by the system.
Rule 7: High-level insert, update, and delete: The system must support set-at-a-time insert,
update, and delete operators. This means that data can be retrieved from a relational database
in sets constructed of data from multiple rows and/or multiple tables. This rule states that
insert, update, and delete operations should be supported for any retrievable set rather than
just for a single row in a single table.
Rule 8: Physical data independence: Changes to the physical level (how the data is stored,
whether in arrays or linked lists etc.) must not require a change to an application based on the
structure.
Rule 9: Logical data independence: Changes to the logical level (tables, columns, rows, and so
on) must not require a change to an application based on the structure. Logical data
independence is more difficult to achieve than physical data independence.
Rule 10: Integrity independence: Integrity constraints must be specified separately from
application programs and stored in the catalog. It must be possible to change such constraints
as and when appropriate without unnecessarily affecting existing applications.
Rule 11: Distribution independence: The distribution of portions of the database to various
locations should be invisible to users of the database. Existing applications should continue to
operate successfully :
1. when a distributed version of the DBMS is first introduced; and
2. when existing distributed data are redistributed around the system.
Rule 12: The non-subversion rule: If the system provides a low-level (record-at-a-time)
interface, then that interface cannot be used to subvert the system, for example, bypassing a
relational security or integrity constraint.
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 3 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
In the days before the relational database model, two data models were commonly
used to maintain and manipulate data the hierarchical database model and the network
database model.
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 4 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
database. The rules can be bent without breaking them if a dummy agent record is inserted in
the AGENTS table; however, this option is not really optimal.
This type of database cannot support complex relationships, and there is often a
problem with redundant data. For example, there is a many-to-many relationship between
clients and entertainers; an entertainer will perform for many clients, and a client will hire
many entertainers. You can't directly model this type of relationship in a hierarchical database,
so you'll have to introduce redundant data into both the SCHEDULE and ENGAGEMENTS tables.
The SCHEDULE table will now have client data (such as client name, address, and phone
number) to show for whom and where each entertainer is performing. This particular
data is redundant because it is currently stored in the CLIENTS table.
The ENGAGEMENTS table will now contain data on entertainers (such as entertainer
name, phone number, and type of entertainer) to indicate which entertainers are
performing for a given client. This data is redundant as well because it is currently
stored in the ENTERTAINERS table.
The problem with this redundancy is that it opens up the possibility of allowing a user to
enter a single piece of data inconsistently. This, in turn, can result in producing inaccurate
information.
A user can solve this problem in a roundabout manner by creating one hierarchical
database specifically for entertainers and another specifically for agents. The
new Entertainers database will contain only the ENTERTAINERS table, and the
revised Agents database will contain the AGENTS, CLIENTS, PAYMENTS, and ENGAGEMENTS
tables. The SCHEDULE table is no longer needed in the Entertainers database because you can
define a logical child relationship between the ENGAGEMENTS table in the Agents database and
the ENTERTAINERS table in the Entertainers database. With this relationship in place, you can
retrieve a variety of information, such as a list of booked entertainers for a given client or a
performance schedule for a given entertainer. Figure 1.2 shows a diagram of the new model.
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 5 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
useful in a number of circumstances, it was clear that a new database model was needed to
address the growing problems of data redundancy and complex relationships among data.
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 6 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
One or more sets (connections) can be defined between a specific pair of nodes, and a
single node can also be involved in other sets with other nodes in the database. In Figure 7.3,
for instance, the CLIENTS node is related to the PAYMENTS node via the Make set structure. It is
also related to the ENGAGEMENTS node via the Schedule set structure. Along with being
related to the CLIENTS node, the ENGAGEMENTS node is related to the ENTERTAINERS node via
the Perform set structure.
A user can access data within a network database by working through the appropriate
set structures. Unlike the hierarchical database, where access must begin from a root table, a
user can access data from within the network database, starting from any node and working
backward or forward through related sets. Consider the Agents database in Figure 7.3 once
again. Say a user wants to find the agent who booked a specific engagement. She begins by
locating the appropriate engagement record in the ENGAGEMENTS node, and then determines
which client "owns" that engagement record via the Schedule set structure. Finally, she
identifies the agent that "owns" the client record via the Represent set structure. The user can
answer a wide variety of questions as long as she navigates properly through the appropriate
set structures.
One advantage the network database provides is fast data access. It also allows users to
create queries that are more complex than those they created using a hierarchical database. A
network database's main disadvantage is that a user has to be very familiar with the structure
of the database in order to work through the set structures. Consider the Agents database in
Figure 7.3 once again. It is incumbent on the user to be familiar with the appropriate set
structures if she is to determine whether a particular engagement has been paid. Another
disadvantage is that it is not easy to change the database structure without affecting the
application programs that interact with it. Recall that a relationship is explicitly defined as a set
structure in a network database. You cannot change a set structure without affecting the
application programs that use this structure to navigate through the data. If you change a set
structure, you must also modify all references made from within the application program to
that structure.
Although the network database was clearly a step up from the hierarchical database, a
few people in the database community believed that there must be a better way to manage
and maintain large amounts of data. As each data model emerged, users found that they could
ask more complex questions, thereby increasing the demands made upon the database. And so,
we come to the relational database model.
Summary:
Dr. Edgar Frank Codd was a computer scientist who proposed thirteen rules (numbered zero
to twelve) and said that if a Database Management System meets these rules, it can be
called as a Relational Database Management System.
Codd in his 1970 paper indicated that there were four major objectives in designing the
relational data model: data independence, simplicity, set-processing and sound theoretical
background.
Two data models were commonly used to maintain and manipulate data the hierarchical
database model and the network database model.
A node represents a collection of records, and a set structure establishes and represents a
relationship in a network database.
The network database was, for the most part, developed as an attempt to address some of
the problems of the hierarchical database.
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 7 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
E. Evaluate
ASSESSMENT:
Instruction: Answer the questions below. Write your answer in the Answer Sheet (AS)
provided for 2 points each.
IDENTIFICATION:
REVIEW QUESTIONS:
Enumerate and explain the advantages of relational model. (5 points each)
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 8 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
Because O’Brien contains an apostrophe, you will receive an error message and the page will
halt. PHP assumes that the apostrophe is code; therefore, the page stops when it arrives at the
unexpected apostrophe.
Open your htdocsfolder, and save a copy of register-page.php with the new name register-
page-apos.php. This is a backup in case you mess up the original page.
In the new file register-page-apos.php, find this line:
<!doctype html>
<html lang=en>
<head>
<title>Register page for apostrophes</title>
<meta charset=utf-8><!--important for escaping problem
characters-->
<link rel="stylesheet" type="text/css" href="includes.css">
</head>
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 9 of 10
ASIAN INSTITUTE OF COMPUTER STUDIES
Bachelor of Science in Computer Science
Course Modules
CC225 - Information Management (Database System)
2nd Year – 2nd Semester
<body>
<div id="container">
<?php include("header.php"); ?>
<?php include("nav.php"); ?>
<?php include("info-col.php"); ?>
<div id="content"><!-- Registration handler content starts here -
->
<p>
<?php
//The link to the database is moved here to the top of the PHP
code.
require ('mysqli_connect.php'); // Connect to the db.
// This query INSERTs a record in the users table.
Scroll down to find the piece of code listed next, and change the line as shown in bold type:
// Check for a last name:
if (empty($_POST['lname'])) {
$errors[] = 'You forgot to enter your last name.';
} else {
$ln = mysqli_real_escape_string($dbcon, trim($_POST['lname']));
}
Scroll down to find the piece of code listed next, and delete the line shown in bold type (or, as I
have done, add two forward slashes to the front of the line to comment it out):
//Start of the SUCCESSFUL SECTION. i.e all the fields were filled
out
if (empty($errors)) { // If everything's OK, register the user in
the database
//require ('mysqli_connect.php'); // Connect to the database.
References:
1. Lecture Notes on Relational Model
https://www.guru99.com/relational-data-model-dbms.html
https://www.w3resource.com/sql/sql-basic/codd-12-rule-relation.php
http://etutorials.org/SQL/Database+design+for+mere+mortals/Part+I+Relational+Datab
ase+Design/Chapter+1.+The+Relational+Database/Early+Database+Models/
2. West, A. W. (2013). Practical PHP and MySQL Web Site Databases: A Simplified
Approach, ISBN-13 (electronic): 978-1-4302-6077-6
Facilitated By:
Name :
Prepared and Validated By: Ms. Almira Sacriz | Dean Manuel Luis C. Delos Santos, MSCS Page 10 of 10