Data and Database

Rohan Rao
6 min readFeb 21, 2022

Data

Data is a fact that is related to a certain object and tells a certain story. It can be anything like a person’s name, a company’s address, an image, a pdf etc.

Database

We live in a data-oriented world. There is data everywhere. And, in order to store the data, we need a database. A Database is a collection of the data stored on an electronic storage in organized manner. The data can then be accessed and manipulated if needed and then stored back in the database.

Types of Databases

There are many different databases available which varies according to their model, design, location, processing power etc.
In this article we will be distinguishing databases based on the model.
There are three major types of databases based on how data is modelled :-

  1. Relational Database :- In a relational database, data is stored in rows and columns in a tabular fashion. A table represents an entity and each row in the table represent a record of that entity. Each of those entity has a fixed number of attributes and this is represented by the columns of the table. Each of the tables has a unique key that is used to uniquely identify a row or a record in a table. The data present in the table shares relation(s) with data present in other table in the relational database. A Relational database always has a fixed schema which the data should abide to. Relational databases are mostly used in a Online Transaction System with frequent read and writes on the data stored.
Relational Data

Advantages of Relational Database :-
a. They are ACID complaint. This means that there is always consistent data in the database.
b. Provides the capability to store any data as well as carry out complex queries.
c. Access is limited or restricted through user permissions
d. Can be easily scaled vertically

Disadvantages of Non-Relational Databases :-
a. Cannot work well with unstructured data.
b. When migrating one RDBMS to another, schemas and types must generally be identical between source and destination tables for migration to work
c. Cannot be easily scaled horizontally.

e.g. — Microsoft SQL Server, Oracle, MySQL, DB2 etc.

2. Non-Relational Database :- A non-relational database model and stores data in an alternate way like key-value, graph, document etc. It doesn’t need the data to be always structured and can work with unstructured data.

There are 4 major types of Non-Relational database :-

i. Key-Value database :- A key-value store is a one where data is stored in key-value pair consisting of an index key and a value. Each key is unique and each of these key has a value attached to it which can be anything like a string or a JSON document etc.
A key value store queries value using the unique key.
It can be used for storing the session data for an application or storing the user search history on an application etc.
e.g. -> Redis, Memecached, Dynamo DB.

Key-value database

ii. Document database :- Document database is an extension of key-value database and stores data in a structured document like a JSON or an XML document. Document name is the key and the contents of the document are the value.
Document database are schema-less, so the data stored in the document doesn’t follow a strict format. One document can have a piece of data that may or may not be present in another document.
This flexibility makes them particularly well-suited to manage semi-structured data like user profiles, content data for an item in an online store etc.
e.g. -> MongoDB, CouchBase.

Document database

iii. Column Based Database :- A column based database can be viewed as a loose combination of relational database and key-value database.
It stored data in a column family as a row that have many columns associated with a unique row key.
It is persistent (data can persist after creation or access), distributed (data is distributed across multiple computing & storage nodes), sorted (sorted keys) and sparse (values for certain dimensions may not be populated, similar to sparsely populated rows in RDBMS).
e.g. -> Google BigTable, Hbase etc.

iv. Graph Database :- A graph database stores data as a network of related nodes or objects in order to facilitate data visualizations and analytics.
A node or object in a graph database contains free-form data that is connected by relationships and grouped according to labels.
As a result, graph databases are typically used when analysis of the relationships between heterogeneous data points is the end goal of the system, such as in fraud prevention, advanced enterprise operations etc.
e.g. -> Azure Graph Database, Neo4j etc.

Graph Database

Advantages of NoSQL database :-
a. Non-Relation Databases can be easily scaled horizontally.
b. Data can be easily stored across different nodes i.e. it supports distributed computing.
c. Schema free data model makes it easy to administer and flexible.

Disadvantage of Non-Relational Database :-
a. Since it doesn’t conform to ACID rules, it is less suitable for Transaction systems.
b. Schema-less approach can sometimes make it hard to find certain data.

3. Object Oriented Database :- An Object oriented database represents data as objects in Object Oriented programming. It combines object-oriented programming concepts with relational database principles.
It has objects ( basic building block and an instance of a class, where the type is either built-in or user-defined), classes (schema or blueprint for objects), Methods(behavior of a class), pointers (access elements of an object database and establish relations between objects).
Object-oriented databases directly deal with data as complete objects. All the information comes in one instantly available object package instead of multiple tables.
The main difference between Object Oriented Database and Relational database is data is stored in an object in Object oriented database but in relational database it is stored in a table.

Object Oriented Database

Advantages Of Object Oriented Database :-
a. As the user can define their own classes, it can store complex data and provide a wide variety of data types.
b. It can be seemlessly integrated with Object Oriented Programming language.
c. It provides extensibility with custom data type.

Disadvantages of Object Oriented Database :-
a. No universal data model makes it less adoptable
b. Can be very complex and can cause performance issues
c. An adequate security mechanism doesn’t exist.

e.g. -> DB4o, Matisse, ObjectDB etc.

Conclusion

All database types have their respective usage domain. None of the database types are a replacement for a different kind of database, and using multiple systems provides versatility over data management.

--

--