You are on page 1of 40

1. What attribute is consists of more than one attribute?

a. primary
b. foreign
c. composite
d. candidate
2. Which of the following is not a table operation?
a. viewing
b. adding
c. deleting
d. searching
3. What are the errors or inconsistencies that are caused by redundancies?
a. anomalies
b. redundancies
c. mistakes
d. normalize
4. Which of the following is a process of efficiently organizing data in a database?
a. synchronization
b. normalization
c. relation
d. organization
5. Which of the following form removes the subsets of data that apply to multiple rows of a
table and place them in separate tables.?
a. 1NF
b. 2NF
c. 3NF
c. 4NF
6. What anomaly is created when one record is updated when the other same data is not
updated thus creating inconsistencies?
a. deletion
b. addition
c. creation
d. modification
Logical Database Design
Logical Database Design

• It is the process of transforming the conceptual data


model (ER Model) into a logical database design
(relational data model).
Types of Logical Models

• hierarchical
• network
• relational
• object-oriented
Overview of Logical Design

Model entities
• each entity type in an ERD is represented as a relation
Model associations
• each relationship in the ERD must be represented in the
relational model
Normalize the relations
• relations must be refined to avoid unnecessary redundancies and
anomalies 
Merge the relations
• redundant relations must be merged
Components of Relational Database Model

• Data structure
- data are organized in the form of tables
• Data manipulation
- powerful data manipulation operations are used (SQL)
• Data integrity
- business rules are included to maintain data integrity
Logical Data Model

• Data is stored in relations (tables)


• A relation consists of tuples (records) and attributes
(fields)
• Each row corresponds to a record
• Each column corresponds to a field
• A record consists of values (instances)
• Goal: to store data without unnecessary redundancy and to
be able to process information easily
• Table/Relation – is a 2-dimesional representation of
data (column and row). A table should have at least
1 field
• Field/Attribute – can have 0 or more records. Fields
can be arbitrarily arranged within a table but
preferably the first field in the order is the primary
key field
• Record – can have 0 or more instances
Properties of Relations

• Entries in columns are atomic (single-valued)


• Entries in columns are from the same domain
• Each row is unique (no duplicate rows)
• The sequence of columns is insignificant
• The sequence of rows is insignificant
Table operations

• addition of records
• deletion of records
• editing of table attribute(s)
• viewing of records
Establishing Keys

• Primary – an attribute (or combination of


attributes) that uniquely identifies each row or
record of a table.
• Composite – primary key that consists of more than
one attribute.
• Foreign - a primary key elsewhere (in another
table). The key that is linked to the primary key.
Anomalies

• These are the errors or inconsistencies that


are caused by redundancies.
• It usually happens when a user attempts to
update the data in a table.
1

2
3 Anomalies

1. Insertion
-This anomaly is created when the user is able to enter employee
data without supplying other needed or referred data.
2. Deletion
-This anomaly is created when one reference of a data is removed
without relating to other tables that also contains the same data.
3. Modification
-This anomaly is created when one records is updated when the
other same data is not updated thus creating inconsistencies
Normalization

• A process of efficiently organizing data in a database.


• It decomposes relations with anomalies to produce
smaller, well-structured relations.
• The transformation of complex user views and data
stores to a set of smaller, stable data structures.
Well-structured relations - contains a minimum amount of
redundancy and allows users to manipulate the data without errors

Two goals:
1.eliminate redundant data
2.ensure data dependencies make sense

• Both of these are worthy goals as they reduce the


amount of space a database consumes and ensure
that data is logically stored.
Normal Form

• The state of a relation that is the result of applying


simple rules regarding functional dependencies.
• Functional dependencies are the relationships
between attributes.
What to normalize?

• Input Forms (e.g. student file)


• Transactions (e.g. sales invoice)

What not to normalized?


-Reports
Fields that should NOT be included in the normalization process:

•Computed Values (e.g. totals)


•Signatures (e.g. Received by) unless required by the end-
users.
Normal Forms

• 1NF
• 2NF
• 3NF
• Boyce/Codd (BCNF)
• 4NF
• 5NF

Flat file – data source forms for normalization


Steps in Normalization
1

2
First normal form (1NF)- The process of separating
the repeating from the non-repeating attributes
identified by a primary key.
1NF sets the very basic rules for an organized
database:
• Eliminate duplicative columns from the same table.
• Create separate tables for each group of related data and
identify each row with a unique column or set of columns
(the primary key).
Second Normal Form (2NF)

• Further addresses the concept of removing duplicative data:


• Meet all the requirements of the first normal form.
• Remove subsets of data that apply to multiple rows of a
table and place them in separate tables.
• Create relationships between these new tables and their
predecessors through the use of foreign keys.
Third Normal Form (3NF)

• Removal of fields that are not-fully dependent on a


non-primary key field (transitive dependencies)
• 3NF goes one large step further:
• Meet all the requirements of the second normal form.
• Remove columns that are not dependent upon the
primary key.
Transitive Dependency

• A nonkey attribute is functionally dependent on one


or more other nonkey attributes
Ex.EMPLOYEE(EmpID, Name, Position, Dept, Manager)
FD: EmpID > Name, Position, Dept, Manager
Dept > Manager
(Dept is not a primary key)
• Remark: anomalies will be encountered
Functional dependency

The value of an attribute in a relation determines the value of


another (1 or more) attributes in the relation
-e.g., Stud_ID > Name, Bday, Course
left-side attribute (Stud_ID) is called a determinant -
determines the values of other attributes in the relation
Examples of Functional Dependencies

• PRODUCT (ProdCode, Desc, Unit, Price)


ProdCode > Desc, Unit, Price
• MOVIE (MovieNo, Title,Category, Copies)
MovieNo > Title, Category, Copies
Partial Dependency

• One or more nonkey attributes are functionally dependent


on only part of the primary key
e.g., STUDENT (IDNum, Name, Address, Bday, Course, Date)
FD: IDnum, Course > Date
IDNum > Name, Address, Bday
(IDNum is only part of the primary key)
• BCNF – remove any remaining anomalies that
result from functional dependencies
• 4NF – remove multi-valued dependencies
• 5NF - remove any remaining anomalies
OBJECTIVES

• Understand and apply the concepts of


Relational Data Models
• Learn the procedures of normalization
• Transform common data modeling situations
to workable relational data models
End 

You might also like