A Database is a collection of meaningful and logical-related data.
Let’s take an example: A Typical postal address in our address book would generally contain:
* Name of the person
* Flat number in the building.
* Name of the building.
* Name of the colony or area.
* Name of the State.
* Pin code.
All of the above data is related to each other which make up the complete address of a person. Hence, an Address Book is a database since it is a collection of multiple and related addresses kept at one place. Here the Address Book is a database and the entry of the set of addresses in it is called its data.
Database Management System (DBMS) - Relational Database Management System (RDBMS)
DBMS is a software system that allows us to insert, delete, update, process the data in the database. Some of the DBMS developed so far are Oracle, Sybase, MS Access, Dbase, Ingress and many more.
RDBMS or Relational Database Management System is a DBMS which stores the data in the form of tables with are related to each other in some or the other way.
A table in a RDBMS is also known as Relation. Each Relation (or table)is a two-dimensional structure which consists of rows and columns, where row makes up a record while column makes up an attribute or field.
This Relational model of DBMS was introduced by Dr. Edgar F. Codd. He laid out some rules which must be satisfied by a database to be a Relational Database. These rules are popularly called 12 Codd’s Rules for RDBMS. Some popular RDBMS are Oracle, Sybase, and DB2 etc.
Normalization and Its Types
Normalization is a process that helps the database designer to reduce the redundant (duplicate) data from the table in a logical manner. Its main aim is to make the data consistent over all the tables in the database. While normalizing a table, it is kept in mind that no data should be lost due to this process.
Let’s summarize the need for Normalization of tables in RDBMS:
1. It simplifies the data maintenance work like updates, inserts and deletes. Normalization relates the tables in a very logical and consistent manner and the change to some specific data in a specific table causes the ripple effect that is the change are made automatically to all instance of that data in the whole database.
2. It increases the data processing speed, in other words makes the data processing fast. (In some cases, it might decrease the speed)
3. It increases the quality of the design by rationalizing the table data.
Types of Normalization
1. First Normal Form.
2. Second Normal Form.
3. Third Normal Form.
4. Boyce-Codd normal Form.
5. Fourth Normal Form.
The last two forms of Normalization are generally not used commercially. Only first three forms are important.
Some important terms of RDBMS
These terms required to be understood in order to understand the forms of normalization and their conditions.
Primary key: A key or attribute or column which identify each record or row in a table uniquely is called Primary key of that table.
Composite key: Sometimes two attributes are used to do the job of primary key then the combination of those two keys is called composite key.
Non-Key Attributes: All the keys or attributes or columns which is not a primary key or a part of primary key are known as Non-Key Attributes.
First Normal Form (1NF)
When a table is broken up (decomposed)into more tables with all repeating groups(records) of data eliminated, table data is said to be in the first normal form (1NF).
A table is said to be in 1st Normal form if:
(a) There is no repeating group.
(b) All the key attributes are defined.
(c) All the non-key attributes are dependent on a primary key.
Second Normal Form (2NF)
A table is said to be in 2nd Normal Form(2NF) if each record is in the table is in the First Normal form(1NF) and each column in the record is fully dependent on its primary key.
A table is in 2nd Normal Form if:
(a) It is in 1st Normal Form.
(b) If no non-key attribute is dependent on a part of composite key( combination of two or more attributes declared as primary key), that is all the attributes must be dependent on the whole composite key not just a part of it.
Note: 2nd Normal Form can be applied only to the table which has any composite key.
Third Normal Form (3NF)
Table is said to be in 3rd Normal Form when all the transitive dependencies are removed from the data.
Transitive dependency is the dependency of a non-key attribute on another non-key attribute of the table.
A table is said to be in 3NF if:
(a) It is in 2NF.
(b) It doesn't contain any transitive dependencies.
There are certain situations when normalization can be avoided. Those situations are as follows:
(a) There is/are no repeating group/groups in the table.
(b) A primary key is defined.
(c) All non-key attributes are fully dependent on key attribute(primary key) or key attributes (composite key).
(d) There is no transitive dependencies.