Learn What is Database | Types of Database | DBMS

In today’s digital world, data is more valuable than ever. It’s the key to smooth functioning of everything from a government to local companies. The success of a company vastly depends on how well they utilize their data.

This is where DATABASE comes into picture. You need a database to store data. In this blog let’s learn what is Database, different types of database available today and understand if database is same as DBMS.

Before we talk about database, it’s important to understand DATA?

Data Name Car.png

What is Data?

Data can be anything and everything. Any information or fact can be considered as data.
Your name, age, data of birth or any other information such as your house address, bank balance, vehicle you drive or even the food you eat can be considered as data.

Data

Details related to a School, technology, statistics and even mathematics can be considered as data and be stored in a database.
Data can be in any form such as an image, file, voice recording, video or even a plain text etc.
For a school, data can be information related to its teachers, students or the subjects they teach.
To summarize, data can be anything and everything and it can be in any format.

Now that you know what data is, let’s dive into understanding database.

Database.jpg

What is Database?

Database can be considered as a container filled with data or information which is electronically stored in a computer system.

Data in any form can be stored into the database.
Purpose of storing data in a database is so that it can be easily accessed, modified, protected and analyzed.

Database-Purpose.png

You may already be using database everyday without your knowledge because most of the websites or mobile apps that you use everyday such as Google, Instagram, WhatsApp, Facebook etc already use database to store their data.

As an example, let’s say, for your college demo project, you plan to develop a simple college timesheet web application.
Basically, this application should allow you to login through a URL and then have options to enter staff details, timesheet details, student attendance, student marks etc.

Since this is a college demo project, you may just use your personal computer to develop this project.

First thing this application will need is a database to store and retrieve data hence you need to first install a database on your computer, which will connect to this timesheet application.
So like any other software installed on your computer, database software will also be allocated a specific location in your computer hard drive. This is the location where the data from the database will be stored.

DB Coll Timesheet 1.png

Through your web application, whenever you try to save, edit or retrieve an information, the application will connect to the database to save, modify or extract the data.

In other words, any information that is shown in your application is actually retrieved from the database and any information entered in the application will actually get stored into the database.

But since this database is installed on your personal computer, the data is actually being stored in your computer hard disk.

This is a simple example of how an application uses a small database to store, modify and retrieve data. When it comes to bigger applications or companies or government, they need huge database to store huge data which may be installed on huge servers.

This is true to any application that uses a database. The images, videos, post or any other information that you see on Facebook is actually stored in a database. And whenever you search for a specific post or friend, Facebook actually searches for this data in its database.

DB Coll Timesheet 2.png


Is Database same as DBMS?

Screenshot 2020-08-30 at 20.33.36.png

What is DBMS?

DBMS.jpg

Lot of people refer to database as DBMS but that’s not entirely correct because database is just a container which stores data whereas Database Management System or DBMS is a software which is used to manage your database.

You need DBMS to interact with database, to store, modify, retrieve and protect data. DBMS is also required to create, modify and delete databases.

Users like you and me can use DBMS to enter commands in specific language to interact with Database.
Example of a DBMS is MySQL, PostgreSQL, MongoDB, Neo4j, Cassandra etc.


Evolution of Database:

Evolution of database started in 1960’s when the first type of database were made which was the Flat File Database. Here the data was stored in simple files such as CSV file or fixed length files etc.

Later on came the Hierarchical Database and then the Network database which stored data though parent child relation ship. But both Hierarchical and Network database were not capable of storing complex data relationships hence were soon replaced by Relational database.

Fast forward to 2020,
In today’s world, there are mainly 2 popular database types.
- Relational Database
- Non-Relational Database (or NoSQL Database)

As per the usage, over 74% of database used today are relational database but due to the immense raise in data usage over the past decade, mainly due to social media platforms, non relational database have become very popular.

However, the biggest companies today who store data related to millions of users everyday generally use combination of both relational and non relational database. Hence both these types of database are very popular and widely used.

Oracle is the most widely used relational database whereas MongoDB is the most widely used non relational database.

Let’s briefly look at each of these database types.

Relational Database:

In a relational database, data is stored through collection of tables. These tables are related to one another.

Each table consist of columns and rows. Each column has a name and a data type. Data type can be said as a data rule which is associated to every column. Only those data that satisfy these data rule can be inserted in the specific column.
A row can be treated as a record which is formed by single or multiple columns.

Relational DB Column Row.png

As an example, if we consider an office database, it may have information related to Employees, Managers and Departments. These details are stored in different tables. But these tables will be related to each other through certain columns.

Here Employee and Manager table is related through the Manager_ID column which is present in both these tables. In a relational database, the foreign key constraint is used to form relations between different tables.

Similarly Manager and Department table are related through dept id column.

As you can see, employee and department table are not directly related to each other. But still it is possible to fetch data from employee table based on specific conditions from department table.

Relational Office DB full.png

This is how relational database works, informations is scattered across multiple tables which are related to one another. Hence using table relations, it is possible to retrieve data from different tables.

In a relational database, using DBMS, you can enter commands in specific language to store, retrieve and modify data.
This specific language is SQL (Structured Query Language)

SQL is a programming language which follows a standard format for querying data across different relations database.

Most of the financial institutions such as a Bank or Insurance companies use relational database.

Examples of relational database are Oracle, MySQL, Microsoft SQL Server, PostgreSQL etc.

Non Relational Database:

When it comes to a non relation database there are several categories of database. Such as:
- Key Value Store / Key Value Database
- Document Database
- Graph Database
- Wide Column Database
- Search Engine Database
- Time Series Database

Each of these database types store data differently and are useful for managing specific types of data.
Lets briefly look at few of these non relational database types:

Key Value Database (Key Value Store):

Key+Value+DB.jpg

Key-value database or Key-value stores is the simplest of non relational database and as the name suggests every data stored in this database will be assigned to a key. To store data, you provide a key and the blob of data such as an image, text file, JSON object etc. Once saved, to retrieve the data just provide the key.
Key-value database are very useful to store certain types of data such as configuration data, state information or any data that might be represented by a dictionary or hash in a programming language.
Example: Redis, Memcached etc.

Document Database:

Document DB.png

Also know as Document Stores. These also use unique key to identify the data stored in database. However, unlike Key-value store, Document database store data in structured format called documents often using JSON, BSON or XML format.
Though each document within this database has structured data, there is no specific format to be followed for all documents.
Each document can have its own structure which the database understands. So unlike Key-value stored, the data stored in document database can be queried and analysed.

Example: MongoDB, CouchDB etc

Graph Database:

Graph database falls under the bracket of non relational database and follows a different approach to forming relationships between data. Rather than using tables and foreign keys to form relation, graph database forms relation by using nodes, edges and properties.

Data is represented through individual nodes and each node can have multiple properties. Between these nodes, Edges (or relationships) are established to represent different types of connections.

Hence in graph database, data is stored as node and relationships are represented through edges. So if you are working with data where relationships or connections between data are most important than graph database is the right choice.

Graph database is useful when searching for a specific pattern like fraud detection through money laundering transactions etc.
Example: Neo4j database.

Graph DB.png


Wide Column Database:

Wide Column DB.png

Also knows as Column family database. Wide column database store data using rows and column but they do not use tables. Instead of table, they use a structure called as column families.

Column families contain rows of data where each row has its own structure or schema. Each row comprises of a unique row identifier and a sets of column names and values. Each row can have different no of columns with different types of data.

Example: Cassandra, HBase etc

Previous
Previous

SQL Basics Tutorial for Beginners (Practice SQL Queries)