Logical Database Design
LOGICAL DATABASE DESIGN
Logical database design is the process of deciding how to arrange
the attributes of the entities in a given business environment into database
structures, such as the tables of a relational database. The goal of logical
database design is to create well structured tables that properly reflect the
company's business environment. The tables will be able to store data about the
company's entities in a non-redundant manner and foreign keys will be placed in
the tables so that all the relationships among the entities will be supported.
What must be included in a logical
database design?
Designing a database involves two distinct
processes.
·
First we
need to understand the requirements of the users. Why do they want a database?
What is it supposed to achieve? What real-world process is it designed to
emulate? Then we need to actually create a technical solution – a set of
tables, complete with columns, each of which has the correct data type. We need
to choose the primary keys, add the correct indexes and so on.
·
The good
news is that it is perfectly possible to separate the two processes. We can
talk to the users and construct a model of the database they want, without
adding any of the technical stuff. This model is called the logical model
because it is a logical description of what we are going to build. Once this
logical model has been agreed on, we can take it away and add the technical
information (data types, indexes etc.). As we do so, we are converting the
logical model into what's called the physical model.
·
So the
logical model captures the users' requirements for the database. Since these
can be complex we usually use a formal process called Entity Relationship (ER)
modeling for this. How does it work in practice? A business analyst talks to
the users and helps them to identify the entities that will appear in the
database (Customers, Salespeople, Goods etc.). Each of these has a set of
attributes: for example, Customers might have attributes such as Name, Age,
Address etc. The business analyst will also help to identify the relationships
between these entities (Customers buy Goods, Salespeople sell Goods). This
information is all captured diagrammatically.
·
In
practice, when we create a logical model we are not so much designing a
database as creating a model of how the business works. So you can also think
of a logical model as a model of the business process that is constructed
during the database design process. So, to revisit the question "What must
be included in a logical database design?"- the answer is entities,
attributes and relationships.
Normalization of Database
Database Normalisation is a technique of organizing the data in the
database. Normalization is a systematic approach of decomposing tables to
eliminate data redundancy and undesirable characteristics like Insertion,
Update and Deletion Anamolies. It is a multi-step process that puts data into
tabular form by removing duplicated data from the relation tables.
Normalization is used for mainly two
purpose,
-
Eliminating
reduntant(useless) data.
-
Ensuring
data dependencies make sense i.e data is logically stored.
Problem Without Normalization
Without Normalization, it
becomes difficult to handle and update the database, without facing data loss.
Insertion, Updation and Deletion Anamolies are very frequent if Database is not
Normalized. To understand these anomalies let us take an example of Student
table.
·
Updation Anamoly : To
update address of a student who occurs twice or more than twice in a table, we
will have to update S_Address column in all the rows, else data will become
inconsistent.
·
Insertion Anamoly :
Suppose for a new admission, we have a Student id(S_id), name and address of a
student but if student has not opted for any subjects yet then we have to
insert NULL there, leading to Insertion Anamoly.
·
Deletion Anamoly : If
(S_id) 401 has only one subject and temporarily he drops it, when we delete
that row, entire student record will be deleted along with it.
Normalization rule are
divided into following normal form.
·
First Normal
Form
·
Second
Normal Form
·
Third
Normal Form
Ulasan