0% found this document useful (0 votes)
144 views47 pages

Advance Database Management System Week 1 - 3

This document provides an introduction and learning objectives for a module on advanced database design and implementation. It begins with definitions of key terms like data, information, databases, and business rules. It then presents five review questions asking learners to define these terms and explain concepts like entities, relationships, tables, fields and records. The document proceeds to explain the differences between data and information and how databases help facilitate the manipulation of data to create useful information. It provides an example comparing data to the components of a student ID versus the full ID which represents information. Finally, it elaborates on how data and information are related through extracting and processing data from a database to form new information.

Uploaded by

Mercy Abejo
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)
144 views47 pages

Advance Database Management System Week 1 - 3

This document provides an introduction and learning objectives for a module on advanced database design and implementation. It begins with definitions of key terms like data, information, databases, and business rules. It then presents five review questions asking learners to define these terms and explain concepts like entities, relationships, tables, fields and records. The document proceeds to explain the differences between data and information and how databases help facilitate the manipulation of data to create useful information. It provides an example comparing data to the components of a student ID versus the full ID which represents information. Finally, it elaborates on how data and information are related through extracting and processing data from a database to form new information.

Uploaded by

Mercy Abejo
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
You are on page 1/ 47

ABEJO MERCY G.

BSIT-2Z

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 1 of 48

Issue No.

WEEK 2 and WEEK 3


Advanced Design and Implementation

INTRODUCTION
In this module, you will review and recall terms on database concepts such as data and
information. The importance of good database design. The business rule and how they
influence design.

LEARNING TARGET
After completing this chapter, you will be able to:
• Define the difference between data and information
• Describe what a database is, the various types of databases, and why they are valuable assets
for decision making
• Explain the importance of database design
• Define what business rules are and how they influence database design
• Identify the relational model’s basic components and explain the structure, contents, and
characteristics of a relational table

• Identify the main characteristics of entity relationship components

ENGAGE

REVIEW QUESTIONS – kindly answer the following questions.


1. How do you define data? What about information? Is there any difference between data
and information? DATA-facts and statistic collected other for reference or
analysis,INFORMATION=facts provided or learned about something or someone.the
different between data and information =Data is a collection of facts.Information is
how you understand those facts in context ,Data is unorganized,while information is
structured or organized.
__________________________________________________________________
_______________________ ______________________________________________
_____________________________________________________________________
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 2 of 48

2. Explain the differences or the relationships among data, information, and a database.
____DATA are raw facts that have not been processed, _____INFORMATION=_is
data that has been processed and given context. DATABASE help to facilitate the
manipulation of data to create information by providing an organizational structure
that makes relationships and connections between data explicit.
_____________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________

3. What is an entity? What is an ERD?


______An entity relationship diagram (ERD),also known as an entity relationship model,is a
graphical representation that depicts relationship among people, objects,places,concepts or events
within an information technology (IT)
system.___________________________________________________
_____________________________________________________________________
_____________________________________________________________________
____________________________________________________________________
____________________________________________________________________

4. What is a business rule?____________________________________________________


describe the operations definitions and constraints that apply to an organization.
____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
5. What is a table? Describe what is a table? What are fields? What are records? A table
has a records (rows) and fields(columns). Fields have different types of data,such as
text,numbers,dates,and hyperlinks. A record: contains specific data,like information
about a particular employee or a product.
Jim__________________________________________________________________
___
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 3 of 48

EXPLAIN
Data versus Information

To understand what drives database design, you must understand the difference between data
and information.

Data consists of raw facts. The word raw indicates that the facts have not yet been processed
to reveal their meaning.

Information is the result of processing raw data to reveal its meaning.

Data processing can be as simple as organizing data to reveal patterns or as complex as


making forecasts or drawing inferences using statistical modeling. To reveal meaning,
information requires context.

Information can be used as the foundation for decision making.


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City
QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 4 of 48

Data is the foundation of information, which is the bedrock of knowledge—that is, the body
of information and facts about a specific subject. Knowledge implies familiarity, awareness,
and understanding of information as it applies to an environment. A key characteristic of
knowledge is that “new” knowledge can be derived from “old” knowledge.

• Data constitutes the building blocks of information.


• Information is produced by processing data.
• Information is used to reveal the meaning of data.
• Accurate, relevant, and timely information is the key to good decision making. • Good
decision making is the key to organizational survival in a global environment.

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 5 of 48
ELABORATE

Data and Information: how are they related?

What you can see above is an example of an ID of a student.

Where are the data?

Each part of the entire ID is the data; course, year, section, student number, name, email, age,
address, contact number as well as the picture is the data.

Where is the Information?

The entire ID is the information.


An ID is a representation of one information of one student.

Data is only part of an Information.

You cannot have an Information if you do not have data.


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM


Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 6 of 48

Data are being extracted from a database to form an information.

Scenario 1: Your teacher wants to know how many students are from Alabang.
Because of your address on your ID, the teacher can verify each of your ID and check the
address, the process of checking the address is now the extraction or processing part.

After finishing the process, the teacher now has the number, example he got 20 students from
Alabang and 30 are not from Alabang.

The 20 from Alabang is now the INFORMATION.

The 20 from Alabang would not be possible if your ID does not contain Address. The 20 from
Alabang came from the data which is the address.

The information will always be based from the given data, there are information that cannot
be provided because of lack of data.

Scenario 2: Your teacher now wants to know how many males and how many females are
there in your class.
Do you think the teacher can accomplish this problem by depending on your ID?

The answer is NO.

Because of lack of data which is the gender, there are no data that the teacher can extract to
get the number of males and females.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 7 of 48
Can the teacher depend on names to determine if a student is male and or female?

The answer is NO.

Some male names sound like females and some female names sound like males.

Again, information relies always on data. Without data you cannot have an information. Thus,
managing information is managing data as well.

Introducing the Database

Efficient data management typically requires the use of a computer database. A database is a
shared, integrated computer structure that stores a collection of the following:

• End-user data or data—that is, raw facts of interest to the end user
• Metadata, or data about data, through which the end-user data is integrated and managed

The metadata describes the data characteristics and the set of relationships that links the data
found within the database.

For example, the metadata component stores information such as the name of each data
element, the type of values (numeric, dates, or text) stored on each data element, and whether
the data element can be left empty.

Example: Age of certain student is 17. 17 is the data and the metadata for the age is number or
numeric.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 8 of 48
Santos is the surname of a certain employee. Santos is the actual data and the metadata is text
or string.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 9 of 48

EXPLAIN

Why Database Design Is Important

Database design refers to the activities that focus on the design of the database structure that
will be used to store and manage end-user data.

A database that meets all user requirements does not just happen; its structure must be
designed carefully.

In fact, database design is such a crucial aspect of working with databases that most of this
book is dedicated to the development of good database design techniques.

Even a good DBMS will perform poorly with a badly designed database.

Database design is just like planning. Just like any other goal to want to achieve it is best way
if you plan.

Remember database stores not just hundreds of records or thousands. It involves millions and
millions of records so if you do not plan or have a good design of your database you will be
having problems in the future.

Situation:
If your entire family will be going on an outing which vehicle do you prefer? A tricycle? A
Jeep? Or a motorcycle?
The answer of course is jeep. Why? Since jeep could cater more persons than the tricycle or
the motorcycle.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 10 of 48

What would happen if you picked tricycle? Well if your family has only 4 members maybe it
can already accommodate. But what if along the way, you see your five cousins who are also
willing to join your outing?

The problem now arises. Just like database design you need to foresee the future. Records
inside your database keeps on increasing. It is NOT good practice to keep on
RESTRUCTURING your database every now and then.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 11 of 48

ELABORATE
Figure 1.7 describes the following terms that you must be familiarized:
DATA - raw facts, such as a telephone number, a birth date, a customer name, and a year-to
date (ytd) sales value.

Data has little meaning unless it has been organized in some logical manner.

FIELD - A character or group of characters (alphabetic or numeric) that has a specific

meaning. A field is used to define and store data.

The fields are C_NAME, C_PHONE, C_ADDRESS …

RECORD - A logically connected set of one or more fields that describes a person, place, or
thing.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 12 of 48

For example, the fields that constitute a record for a customer might consist of the customer's
name, address, phone number, date of birth, credit limit, and unpaid balance.
FILE - A collection of related records.

For example, a file might contain data about the students currently enrolled at gigantic
University.

EXPLAIN
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 13 of 48

Business Rules
A business rule is a brief, precise, and unambiguous description of a policy, procedure, or
principle within a specific organization. In a sense, business rules are misnamed: they apply
to any organization, large or small—a business, a government unit, a religious group, or a
research laboratory—that stores and uses data to generate information.

Business rules derived from a detailed description of an organization’s operations help to


create and enforce actions within that organization’s environment.

Business rules must be rendered in writing and updated to reflect any change in the
organization’s operational environment. Properly written business rules are used to define
entities, attributes, relationships, and constraints.

A description of a policy, procedure, or principle within an organization.

For example, a pilot cannot be on duty for more than 10 hours during a 24-hour period, or a
professor may teach up to four classes during a semester.

Any time you see relationship statements such as “an agent can serve many customers, and
each customer can be served by only one agent,” business rules are at work. You will see the
application of business rules throughout this book, especially in the chapters devoted to data
modeling and database design.

To be effective, business rules must be easy to understand and widely disseminated to ensure
that every person in the organization shares a common interpretation of the rules. Business
rules describe, in simple language, the main and distinguishing characteristics of the data as
viewed by the company.

Examples of business rules are as follows:


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 14 of 48
• A customer may generate many invoices.

• An invoice is generated by only one customer.

• A training session cannot be scheduled for fewer than 10 employees or for more than 30
employees.
Note that those business rules establish entities, relationships, and constraints.

For example, the first two business rules establish two entities (CUSTOMER and INVOICE)
and a 1:M relationship between those two entities. The third business rule establishes a
constraint (no fewer than 10 people and no more than 30 people) and two entities
(EMPLOYEE and TRAINING), and also implies a relationship between EMPLOYEE and
TRAINING.

Discovering Business Rules


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 15 of 48
The main sources of business rules are company managers, policy makers, department
managers, and written documentation such as a company’s procedures, standards, and
operations manuals. A faster and more direct source of business rules is direct interviews
with end users. Unfortunately, because perceptions differ, end users are sometimes a less
reliable source when it comes to specifying business rules. For example, a maintenance
department mechanic might believe that any mechanic can initiate a maintenance procedure,
when actually only mechanics with inspection authorization can perform such a task. Such a
distinction might seem trivial, but it can have major legal consequences. Although end users
are crucial contributors to the development of business rules, it pays to verify end-user
perceptions. Too often, interviews with several people who perform the same job yield very
different perceptions of what the job components are. While such a discovery may point to
“management problems,” that general diagnosis does not help the database designer. The
database designer’s job is to reconcile such differences and verify the results of the
reconciliation to ensure that the business rules are appropriate and accurate.

The process of identifying and documenting business rules is essential to database design for
several reasons:
• It helps to standardize the company’s view of data.
• It can be a communication tool between users and designers.
• It allows the designer to understand the nature, role, and scope of the data.
• It allows the designer to understand business processes.

• It allows the designer to develop appropriate relationship participation rules and constraints
and to create an accurate data model. Of course, not all business rules can be modeled.

For example, a business rule that specifies “no pilot can fly more than 10 hours within any
24-hour period” cannot be modeled in the database model directly. However, such a business
rule can be represented and enforced by application software.

Translating Business Rules into Data Model Components


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 16 of 48
Business rules set the stage for the proper identification of entities, attributes, relationships,
and constraints. In the real world, names are used to identify objects. If the business
environment wants to keep track of the objects, there will be specific business rules for the
objects.

As a general rule, a noun in a business rule will translate into an entity in the model, and a
verb (active or passive) that associates the nouns will translate into a relationship among the
entities.

For example, the business rule “a customer may generate many invoices” contains two nouns
(customer and invoices) and a verb (generate) that associates the nouns.

From this business rule, you could deduce the following:


• Customer and invoice are objects of interest for the environment and should be represented
by their respective entities.
• There is a generate relationship between customer and invoice.
To properly identify the type of relationship, you should consider that relationships are
bidirectional;
that is, they go both ways.

For example, the business rule “a customer may generate many invoices” is complemented
by the business rule “an invoice is generated by only one customer.”

In that case, the relationship is one-to-many (1:M). Customer is the “1” side, and invoice is
the “many” sides.
To properly identify the relationship type, you should generally ask two questions:
• How many instances of B are related to one instance of A?

• How many instances of A are related to one instance of B?


For example, you can assess the relationship between student and class by asking two
questions:
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 17 of 48
• In how many classes can one student enroll? Answer: many classes.
• How many students can enroll in one class? Answer: many students.

Therefore, the relationship between student and class is many-to-many (M:N). You will have
many opportunities to determine the relationships between entities as you proceed through
this book, and soon the process will become second nature.

EXPLAIN
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 18 of 48
Relational database terminology is very precise.

Unfortunately, file system terminology sometimes creeps into the database environment.

Thus, rows are sometimes referred to as records, and columns are sometimes labeled as
fields.

Occasionally, tables are labeled files.

Technically speaking, this substitution of terms is not always appropriate.

The database table is a logical concept rather than a physical concept, and the terms file,
record, and field describe physical concepts.

Nevertheless, as long as you recognize that the table is actually a logical concept rather than a
physical construct, you may think of table rows as records and table columns as fields.

In fact, many database software vendors still use this familiar file system terminology.

Database name: DbCITCS Table name: tblStudent


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 19 of 48
Review of terms from previous lesson:

Please refer on the table above for the following lessons.

A database can contain 1 or more tables.

The table name or the name of relation is tblStudent and tblGrade.

The fields or attributes are lname, fname, course, yr, email, section.

The number of records or number of tuples is 8. Starting from the record of Reyes, John until
the record of Solomon, Andy.

Again, throughout this module you will always encounter these terms so please read and
understand.

Keys or Superkeys

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM


Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 20 of 48

In the relational model, keys are important because they are used to ensure that each row
in a table is uniquely identifiable.

They are also used to establish relationships among tables and to ensure the integrity of the
data.

A certain database can contain two or more tables. Those tables must be linked or relate
together using this keys that you will be learning. Hence, the relational came from the word
relate, to link tables two or more tables together.

A key consists of one or more attributes that determine other attributes. Example of one

attribute key: StudID, Email

Example of two attribute key: Studid+Email, Studid+Section, Email+Section, Email+Course


Types of Keys

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 21 of 48

A composite key is a key that is composed of more than one attribute.

For example, Studid+Email, Studid+Section, Email+Section, Email+Course

A candidate key is a minimal superkey—that is, a superkey without any unnecessary


attributes.

For example, studID would be a candidate key, as would (lname+fname+email).

On the other hand, (studid+lname) is a superkey, but it is not a candidate key because
STU_LNAME could be removed and the key would still be a superkey.

A table can have many different candidate keys.


If the STUDENT table also included the students’ Phone numbers as PhoneNum, then it
would appear to be a candidate key.

Candidate keys are called candidates because they are the eligible options from which the
designer will choose when selecting the primary key.

The primary key (PK) is the candidate key chosen to be the primary means by which the
rows of the table are uniquely identified.

Example, StudId.

Entity integrity is the condition in which each row (entity instance) in the table has its own
unique identity.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 22 of 48

To ensure entity integrity, the primary key has two requirements:


(1) all of the values in the primary key must be unique and
(2) no key attribute in the primary key can contain a null.

Null values are problematic in the relational model.


A null is the absence of any data value, and it is never allowed in any part of the primary key.

From a theoretical perspective, it can be argued that a table that contains a null is not properly
a relational table at all. From a practical perspective, however, some nulls cannot be
reasonably avoided. For example, not all students have a middle initial.

For example, a null could represent any of the following:


• An unknown attribute values

• A known, but missing, attribute value

• A “not applicable” condition Depending on the sophistication of the application


development software, nulls can create problems when functions such as COUNT,
AVERAGE, and SUM are used.

A foreign key (fK) is the primary key of one table that has been placed into another table to
create a common attribute.
The studid on tblgrade is the primary key on tblStudent and a foreign key on tblgrade.
The primary key on one table and the foreign key on the other table us used to connect
both tables.
Just as the primary key has a role in ensuring the integrity of the database, so does the foreign
key.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 23 of 48

Foreign keys are used to ensure referential integrity, the condition in which every reference to
an entity instance by another entity instance is valid.

In other words, every foreign key entry must either be null or a valid value in the primary key
of the related table.
EXPLAIN
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 24 of 48

Relationships within the Relational Database

In this lesson, you will learn how ERD is applied on tables and its relationship.
ONE-TO-MANY

Example 1: You may recall on your previous example on ERD.


a PAINTER PAINTS many PAINTINGs but
a PAINTING can only be painted by only one PAINTER

On the ERD, an ENTITY is a TABLE on Relational Database.


PAINTER entity on ERD = tblPAINTER on Relational Database
PAINTING entity on ERD = tblPAINTING on Relational Database

The red line indicates the relationship between tables.


Pid as primary key on tblPainter and pid on tblPainting
as Foreign key.

In One-to-many relationship, id of PAINTER can have


many
occurances on tblPAINTING table but only once on
tblPAINTER.

ONE-TO-ONE
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 25 of 48

Example 2: a DEAN can only be assigned to one COLLEGE and


a COLLEGE can only be assigned by only one DEAN
The red line indicates the relationship between tables.
Pid as primary key on tblDean and pid on tblCollege
as Foreign key.

In One-to-ONE relationship, id of DEAN can only


occur once on tblCOLLEGE table and only once on
tblDEAN.

EXPLAIN
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 26 of 48

The ERD represents the conceptual database as viewed by the end user.
ERDs depict the database’s main components: entities, attributes, and relationships.

Because an entity represents a real-world object, the words entity and object are often used
interchangeably.

Because of its emphasis on implementation, the Crow’s Foot notation can represent only
what could be implemented. In other words:
• The Chen notation favors conceptual modeling.
• The Crow’s Foot notation favors a more implementation-oriented approach. • The
UML notation can be used for both conceptual and implementation modeling.

Entities

An entity is an object of interest to the end user.

An entity in the ERM corresponds to a table—not to a row—in the relational environment.

The ERM refers to a table row as an entity instance or entity occurrence.

Attributes

Attributes are characteristics of entities.

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 27 of 48
For example, the PAINTER entity includes the attributes pid, pname among many others.

In the original Chen notation, attributes are represented by ovals and are connected to the
entity rectangle with a line.

Each oval contains the name of the attribute it represents.

In the Crow’s Foot notation, the attributes are written in the attribute box below the entity
rectangle.

Attribute Types

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 28 of 48

Required and Optional Attributes

A required attribute is an attribute that must have a value; in other words, it cannot be left
empty.

Example, lastname and firstname require data entries because all person are assumed to have
a names.
However, not all have a middle name, and perhaps they do not yet have a phone number and
an email address.

Therefore, those attributes are not presented in boldface in the entity box.

An optional attribute is an attribute that does not require a value; therefore, it can be left
empty.

Domains Attributes have a domain.

A domain is the set of possible values for a given attribute.

For example, the domain for a grade point average (GPA) attribute is written (0,4) because
the lowest possible GPA value is 0 and the highest possible value is 4.

The domain for a gender attribute consists of only two possibilities: M or F (or some other
equivalent code).

The domain for a company’s date of hire attribute consists of all dates that fit in a range (e.g.,
company startup date to current date).
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 29 of 48

Identifiers (Primary Keys)

The ERM uses identifiers—one or more attributes that uniquely identify each entity instance.

In the relational model, entities are mapped to tables, and the entity identifier is mapped as
the table’s primary key (PK).
Identifiers are underlined in the ERD.

Key attributes are also underlined in a frequently used shorthand notation for the table
structure, called a relational schema, that uses the following format:

TABLE NAME (KEY_ATTRIBUTE 1, ATTRIBUTE 2, ATTRIBUTE 3, … ATTRIBUTE


K)

For example, a CAR entity may be represented by CAR (CAR_VIN, MOD_CODE,


CAR_YEAR, CAR_COLOR)

Each car is identified by a unique vehicle identification number, or CAR_VIN.

Composite Identifiers

Ideally, an entity identifier is composed of only a single attribute.

Composite and Simple Attributes


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 30 of 48

A composite attribute, not to be confused with a composite key, is an attribute that can be
further subdivided to yield additional attributes.

For example, the attribute ADDRESS can be subdivided into street, city, state, and zip code.

Similarly, the attribute PHONE_ NUMBER can be subdivided into area code and exchange
number.

A simple attribute is an attribute that cannot be subdivided.

For example, age, sex, and marital status would be classified as simple attributes.

Single-Valued Attributes

A single-valued attribute is an attribute that can have only a single value.

For example, a person can have only one Social Security number, and a manufactured part
can have only one serial number.

Multivalued Attributes

Multivalued attributes are attributes that can have many values.

For instance, a person may have several college degrees, and a household may have several
different phones, each with its own number.

Derived Attributes
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 31 of 48

A derived attribute is an attribute whose value is calculated (derived) from other attributes.

The derived attribute need not be physically stored within the database; instead, it can be
derived by using an algorithm.
Example, the Age of a person. Using an SQL function, you can compute for the age of a
person.

Developing an ER diagram

The process of database design is iterative rather than a linear or sequential process.

The verb iterate means “to do again or repeatedly.” Thus, an iterative process is based on
repetition of processes and procedures.

Building an ERD usually involves the following activities:

• Create a detailed narrative of the organization’s description of operations.


• Identify the business rules based on the description of operations.
• Identify the main entities and relationships from the business rules.
• Develop the initial ERD.
• Identify the attributes and primary keys that adequately describe the entities.
• Revise and review the ERD.

ELABORATE

Entity Relationship Diagram (Crow’s Foot Notation)


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 32 of 48

On the previous lesson you have learned how to create an ERD. The ERD that you have
learned was Chen’s Notation.

This time, you will be learning how create an ERD - Crow’s Foot Notation.
Crows Foot Notation comes from the word “CROW” because the symbol used looks like
crow’s foot.

COMPARISON

Compared with Chen’s Notation, the Crow’s Foot Notation is easier to draw because you
only need to draw a rectangle and put a line on the upper part to separate ENTITY and its
attributes. Crow’s Foot Notation is more precise when it comes to connectivity.

WHAT IS MANY?
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 33 of 48

Cardinality - expresses the minimum and maximum number of entity occurrences associated
with one occurrence of the related entity.

Example 1: a PAINTER paints many PAINTINGS but


a PAINTING can only be painted by one PAINTER

How do you consider a certain person as painter? If he has AT LEAST one painting. So
therefore, a painter must have at least one painting and can have many paintings. We can
now revise the rule above and replace the many with more precise connectivity.

Thus, as a PAINTER paints one or many PAINTINGS but


a PAINTING can only be painted by one and only one PAINTER.

Example 2: a DEAN can be assigned to one COLLEGE and


a COLLEGE can only be managed by one DEAN
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 34 of 48

Revised: a DEAN can be assigned to one and only one COLLEGE and
a COLLEGE can only be managed by one and only one DEAN

Example 3: an EMPLOYEE can learn many SKILLs and


a certain SKILL can be learned by many EMPLOYEEs

Revised: an EMPLOYEE can learn one or many SKILLs and


a certain SKILL can be learned by one or many EMPLOYEEs

Try to draw the ERD of the given business rule below using Crow’s Foot Notaion.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 35 of 48

Example 4: a PERSON can have a zero or many CARs but


a CAR can only be owned by one and only one PERSON
Example 5: a CUSTOMER can have a zero or many ORDERs but
a specific ORDER can only be made by one and only one CUSTOMER
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 36 of 48

The diagram above shows the symbols of different attributes that you need to use when
indicating an attribute on ERD.

On Chen’s, a primary key is underlined.


Derived attribute is connected using broken lines.
Multi-valued attribute is connected with double lines.

On Crow’s, you need to add the cardinality, the minimum and the maximum occurrences
(1,5).
The primary key attribute is underlined and a label on the left side is indicated (PK) and (FK).

Example: An ERD of a student database using both Chen’s Notation and Crow’s Foot
Notation.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City
QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 37 of 48

On Crow’s Foot Notation, it is more precise as to how many students can a class have.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 38 of 48

A class can have a minimum of 15 students and a maximum of 40.


A student can have one class but only limited to 6 classes.

And the connection between two entities is clearer than on Chen’s. Lines is connected
between PK from STUDENT entity and FK from CLASS entity unlike again on Chen’s.

NOTE: The minimum and the maximum will also be based on the Business Rules.
Different schools have different rules.
ENGAGE
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 39 of 48

Look and study the table in SQL 1.1 and answer the following questions below.

SQL 1.1 – List of Students

1. How many students whose last names (lname) are Reyes?


_______________________________________________________________

2. How many BSIT students are there?


_______________________________________________________________
3. What is the student id (studID) of a student whose course is ACT?
_______________________________________________________________

4. How many records can you see? What about fields?


_______________________________________________________________

5. How many rows can you see? What about columns?


_______________________________________________________________

6. TRUE / FALSE. All students are second year students?


_______________________________________________________________

7. TRUE / FALSE. Cristy Reyes is the oldest student.

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 40 of 48
_______________________________________________________________ EXPLAIN

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 41 of 48
SQL 1.1 – List of Students

The image above is called a Table. A table is an object where the actual data resides.

All the boxes or cells are where the data resides.

The database is an object where the table will be saved.

A database can contain 1 or more tables.

studID, lname, fname, course, yr and section are called Fields, or columns on the table.

Therefore, the table consists of 6 Fields or 6 columns

111, Reyes, John, BSIT, 2, A is called a Record or Information.

Therefore, the table has 5 records or 5 information.


LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 42 of 48

Technically you cannot see the actual database, what is visible to you is the table,
fields(columns) and records(information).
Do not forget this lesson for you to not be confused on future lessons especially if you are
doing the SQL.

ELABORATE
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 43 of 48
Creating a database and a table using SQL.
Database name: dbCITCS
Table name: tblStudent

Fields: Types:
studID integer
lname string
fname string
course string
yr integer
section char

SQL 1.1 – List of Students

You will now learn how to create a database.

LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA


MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 44 of 48

To create a database, you need to learn the SQL.

SQL stands for Structured Query Language.


It is the language that you need to learn for you to be able to create a database and table,
insert records, update and delete records.

A table is inside a database, and the data are inside the table. So following the order, the
database must be created first, then the table and after you create the table you can now insert
the records.

A database and a table has its name, in the example above the name of the database is CITCS
and the name of the table is Student.

But for readability purpose and to avoid confusion among your objects, you can add a prefix
for database and table.

For naming a database add db, so your database name is dbCITCS.

For naming a table add tbl, so your database name is tblStudent.

Naming a field. The first field or first column is studID which stands for student id. The
second field is lname which stands for lastname.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 45 of 48

You can use any field name, but I suggest to simplify your name, avoid long names for you
will be using this names on your codes. The longer the names of your fields the longer your
codes will be.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 46 of 48

EVALUATE

I. Inside the box are possible answer to the problems below.

Derived Entity
RECORD Database design
Single-valued Information
Raw Required
Database Business Rule
Metadata

1. ___________ is produced by processing data.


2. The word __________ indicates that the facts have not yet been processed to
reveal their meaning.
3. __________ or data about data, through which the end-user data is integrated
and managed.
4. __________ exists when different versions of the same data appear in
different places.
5. The __________ attribute need not be physically stored within the database;
instead, it can be __________ by using an algorithm.
6. A __________ attribute is an attribute that must have a value; in other words,
it cannot be left empty.
7. __________ is a detailed description of an organization’s operations help to
create and enforce actions within that organization’s environment.
8. __________ is a logically connected set of one or more fields that describes a
person, place, or thing.
9. An __________ in the ERM corresponds to a table—not to a row—in the
relational environment.
10. A __________ attribute is an attribute that can have only a single value.
II. Based on the following business below, identify the entity, the attribute and type of
attribute and draw the ERD.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 47 of 48

Example: DOCTOR can have many specializations

specialization DOCTOR

1. A vehicle can have many colors

2. The primary key of a car is plateNumber

3. An employee has many addresses

4. A computer has many speifications


5. The totalPrice of all items

III. Identify what type exists between two given entities. And draw the ERD for each.
LEARNING PAMANTASAN NG LUNGSOD NG MUNTINLUPA
MODULE COLLEGE OF INFORMATION
TECHNOLOGY AND COMPUTER STUDIES
University Road, Poblacion, Muntinlupa City

QD/CITCS/0__ Course Title: ADVANCE DATABASE MANAGEMENT SYTEM

Issue No. 0 Revision No. 0 Effectivity Date 07 September 2020 Page No. 48 of 48

1. Teacher entity and student entity.


a. One-to-one b. one-to-many c. many-to-many

2. Student entity and Room entity


a. One-to-one b. one-to-many c. many-to-many

3. Bus entity and passenger entity


a. One-to-one b. one-to-many c. many-to-many

4. Dean Entity and College Entity


a. One-to-one b. one-to-many c. many-to-many
5. Book Entity and Borrower Entity
a. One-to-one b. one-to-many c. many-to-many

You might also like