You are on page 1of 7

Design File/Database

File:
A file is a collection of data and information arranged and stored as a single entity called record.
A file contains groups of records used to provide information for operations, planning,
management, and decision making. Files are typically designed to meet the needs of a particular
application.

Database:
A database is an organized collection logically related records arranged and stored as a tuple in a
table. Database is especially designed to store and manage large bodies of information regarding
to various application.

The heart of a database is the database management system (DBMS), which allows the creation,
modification, and updating of the database; the retrieval of data; and the generation of reports
and displays. Thus, DBMS is software that allows us to handle the database.

Conventional Files VS Database:


Conventional File Database
1) File is a collection of data in the form of 1) Database is a collection of logically related
record. records.
2) Easy to design because of their single 2) More complex to design because for their
application. variety application.
3) File encompresses the problem of Data 3) Database avoids the problem of Data
inconsistency and data integrity. inconsistency and data integrity.
4) Security of data in file is not good. 4) Security of data in database is very good.
5) Cost of implementing file is less. 5) Cost of implementing database is high as it
requires DBMS and Database administer.
Data Concepts:
Reality:
The real world is referred to as reality. Thus, data resident into a real world are called reality.

Data:
Data are any facts number or texts that are processed to get information. They are the raw
materials which are consumed by processes and converted into valuable information.

Metadata:
Data that provides information about other data are called metadata. It is descriptive information
about a particular data set, object, or resource, including how it is formatted, and when and by
whom it was collected.

Guidelines for Database Design:


 Construct ER diagram for data modeling.
 Fit the modeled data into tables.
 Normalize all tables.

Basic construct of ER Model:

Relationship:
 One-to-one
 One-to-many
 Many-to-one
 Many-to-many
Basic construct of Table:

Concept Definition Examples

Records(Rows) A record holds all of the various discrete Roll Name Address Contact
pieces of data for single entry.

Fields(Columns) A field is a discrete piece of Ram


information.
Shyam

Hari

Key Constraints Constraints that uniquely identifies Primary Key, Secondary Key,
record or establish and enforce a link Foreign Key
between the data in two tables.

Key Constraints:
a) Primary Key:
A primary key is a field with values that are unique throughout a table. The Primary
key constraint uniquely identifies each record in a database table.

b) Secondary Key:
A primary key is a field with unique or not-unique values that provides indexes to the
table. Secondary keys are used to view records in an order that is different from the order
defined by the primary key fields.
c) Foreign Key:
A foreign key is a field in one table that uniquely identifies a row of another table.
A foreign key are used to link two tables together.

Foreign Key
Primary Key Secondary Key

E-R models to Table:

ER Model Table

Entity Record(row)

Attribute Field(column

One to one relationship  One table is created for each entity.


 The key of either one of the tables is placed as the foreign key in
the other table.

One to many relationship  One table is created for each entity.


 The key of the table on the "one" side of the relationship (parent)
is placed as the foreign key in the table representing the "many"
side of the relationship (child).

Many to many relationship  One table is created for each entity.


 One table is created for the relationship itself.

Normalization:
Normalization is a process of breaking down a single complex table into two or more simple
table and defining a relationship between those tables. In other word, normalization is a process
of structuring the tables for reducing redundancy. It also helps to avoid inconsistencies of data.

Normal Form:
There are various levels of normalization. These levels are called normal forms.

First Normal Form (1NF):


An entity is in the first normal form if it contains no repeating groups. 

Second Normal Form (2NF):


A relation is in 2NF if it is in 1NF and every non-key attribute is fully dependent
on each candidate key of the relation.

Third Normal Form (3NF):


A relation is in third normal form, if it is in 2NF and every non-key attribute of
the relation is non-transitively dependent on each candidate key of the relation.

Example:
Unnormalized Table
1 NF Table

2 NF Table

You might also like