Lecture 1 Introduction To Database

You might also like

Download as ppsx, pdf, or txt
Download as ppsx, pdf, or txt
You are on page 1of 28

Introduction to Databases

Lecture Overview
Definition of Data, Entity, Database (DB).
Definition of (Table, Row or Record, Column or
Field).
Definition of Database Management System
(DBMS).
Flat file, its advantages and disadvantages.
Data Analysis and Normalization.
Normalization Steps.
Some Examples.
Home Activity.
Data, Entity, Database (DB)
Data:
A data is a collection of information about an entity.
Entity:
An entity is an object like person, place, location, event or
any thing need to collect information about it.
Database (DB):
A database is a method for storing data.

Database Management System (DBMS):


It is a computerized for DB, or DB with software and users
to access the data stored in the database files.
Table, Row (Record), Column (Field)
Table:
A table is a collection or related data about object or
related objects, it consists of rows and columns, the
system analyst called it (Entity).
Row:
A row—also called a record or tuple—represents a
single, implicitly structured data item in a
table(Horizontal Line in a table).
Column:
A column, field or attribute is a set of data values of a
particular simple type, one for each row of the table.
Table, Row (Record), Column (Field) …cont.
..
Database Management System (DBMS)
Database Management System (DBMS):
It is a computerized for DB, or DB with software and users
to access the data stored in the database files.
Flat file, its advantages and disadvantages
Flat File:
A flat file database is a type of database that stores data
in a single table.
Advantages of Flat File:
Easy to understand.
Easy to implement.
Less hardware and software requirements.
Less Skills set are required to hand flat database
systems.
Best for small databases.
Flat file, its advantages and disadv. …cont.
Flat file, its advantages and disadv. …cont.

Disadvantages of Flat File:


Less security easy to extract information.
Data Inconsistency.
Redundancy.
Sharing of information is cumbersome task.
Slow for huge database.
Searching process is time consuming
Data Analysis and Normalization
Normalization:
Normalization is a data analysis methodology to design a
database system. It allows the database designer to
understand the current data structures within an
organization. Furthermore, it allows for any future
changes and enhancements to the system.

The end result of normalization is a set of entities, which


removes unnecessary redundancy (i.e. duplication of
data) and avoids the abnormality.
Data Analysis and Normalization …cont.
Key:
A key is a set of one or more columns (attributes) which
is used to identify rows in a table.
Primary Key:
A Primary key is a set of one or more columns which is
used to uniquely identify rows in a table.
Secondary Key:
Candidate keys after selected primary key called
Secondary Key.
Foreign Key:
A Foreign key is a set of one or more columns which is
refer to primary key in other table for relationship.
Normalization Steps
The steps of normalization are:

Select the data source and convert into an


unnormalized table (UNF).
Transform the unnormalized data into first normal form
(1NF).
Transform data in first normal form (1NF) into second
normal form (2NF).
Transform data in second normal form (2NF) into third
normal form (3NF)
Normalization Examples
The following company report, describes projects being
worked upon by employees, this report is to be normalized
Normalization Examples …cont.

The first step is to select the data source (i.e. the previous
report) and convert into an unnormalized table (UNF):
Create column headings for the table for each data item
on the report (ignoring any calculated fields).
Enter sample data into table.
Identify a key for table (and underline it).
Project Code chosen for the key and duplicate data,
associated with each project code.

The table will be as the following figure:


Normalization Examples …cont.
Normalization Examples …cont.
Normalization Examples …cont.

The next step is to transform the table of unnormalised


data into first normal form (1NF):
Identify repeating attributes.
Remove these repeating attributes to a new table together
with a copy of the key from the UNF table.
Assign a key to the new table.

The tables will be as the following figure:


Normalization Examples …cont.
Normalization Examples …cont.

The next step is to transform the data in first normal form


(1NF) into second normal form (2NF), The rule is:
remove any non-key attributes that only depend on part of
the table key to a new table:

The tables will be as the following figure:


Normalization Examples …cont.
Normalization Examples …cont.

The next step is to transform the data in second normal


form (2NF) into third normal form (3NF), The rule is:
remove to a new table any non-key attributes that are
more dependent on other non-key attributes than the table
key.

The tables will be as the following figure:


Normalization Examples …cont.
Normalization Examples …cont.

Occasionally, the data may still be subject to anomalies in


third normal form. In this case, we may have to perform
further transformations.

Transform third normal form to Boyce-Codd normal


form (BCNF).
Normalization Examples …cont.
Ex: (1-1):
Normalization Examples …cont.
Ex: (1-2):
Home Activity 1
Implement all process of normalization from unnormalized data till
the last step of normalization for the following students results:
Home Activity 2

Suppose we have the following fields in


telecommunication System as a flat file report:
Contract_FName, Contract_MName, Contract_LName, Gender,
Contract_Type, ID_Card_NO, ID_Card_Type, ID_Card_Issue_Date,
ID_Card_Expire_Date, MSISDN, MSISDN_Type, MSISDN_Status,
MSISDN_Cost, Service_ID, Service_Type, Service_Name, Service_Price,
Service_Start_Date, Service_End_Date, Service_Status,
Call_Type, Call_Date, Call_Duration, Other_Party, Call_Cost

Implement all process of normalization from


unnormalized data till the last step of normalization.
END OF FIRST LECTURE
See you in the second lecture
With My Best Wishes
Hamdy Esckander

You might also like