Introduction
If you want to save data to go back to when you need to use it in the future, how will you save it? Maybe you will say I will write it in a text file. But if you have a large data it will be difficult to fetch it. So you need another way to organize data and save it.
There are several ways, you can organize your data as a Hierarchy or you can organize it in tables and make relations between tables like an Excel sheet. We called the second-way relational database.
Relational database
They arose out of Edgar Codd’s 1970 paper “A Relational Model of Data for Large Shared Data Banks”.
As said before we can Think of the relational database as a collection of spreadsheet files that help businesses organize, manage, and relate data. In the relational database model, each “spreadsheet” is a table that stores information, represented as columns (attributes) and rows (records or tuples). There is some important terminology to understand the relation data model:
1- Entity: is an object and has attributes for example you have a database for a company in the company you have employees so you will create an employee entity and give it attributes like ID, age, salary, shift….
Employee |
ID |
Age |
Salary |
Shift |
2- relation: is a table or file, is a subset of the Cartesian product of a list of domains.
3-domain: A domain is the original set of atomic values used to model data. By atomic value, we mean that each value in the domain is indivisible as far as the relational model is concerned. For example, the domain for shift row is {Monday, Thursday, Wednesday, …, Sunday}.
SQL
Unlock the Potential of Your Business with AIT Systems
From web development to mobile app solutions, AIT Systems turns your ideas into reality. Let’s build something great together.
“It provides a means of describing data with its natural structure only-that is, without superimposing any additional structure for machine representation purposes. Accordingly, it provides a basis for a high level data language which will yield maximal independence between programs on the one hand and machine representation and organization of data on the other.” Codd[1970].
SQL is a computer language that you use to interact with a rational database. SQL is not a database management system (we will talk about database management system in another article) SQL is a language to contact with database management system or database engine.
NoSQL
We meant by NoSQL non-relational database. we have four type
1-Key-value:
like DynamoDB. save the data as items containing key and value
2- document-oriented:
like Firebase and MongoDB. save the data as JSON
3- wide-column:
like HBase. save data as a table but not like a rational database
4- graph:
like Neo4J. save data as a graph data structure.
NoSQL | SQL |
Uses many types of data model depends on the type of No SQL | uses a tabular data structure |
provides a flexible schema | fixed schema |
There is many language depends on the type of NoSQL MongoDB uses MQL | uses structured query language |
Relationships can be nested, explicit, or implicit. | Relationships are defined through foreign keys and accessed using joins. |
suitable for real-time processing, big data analytics, and distributed environments. | suitable for read-heavy and transaction workloads |
Advantages of NoSQL
1- High Scalability
NoSQL databases can expand out by employing commodity hardware as opposed to scaling up by adding more servers. This can handle more traffic to meet demand without experiencing any downtime. NoSQL databases are now the go-to choice for growing data sets since they can grow bigger and more capable by scaling out.
2- High Availability
NoSQL databases automatically replicate data across multiple servers, data centers, or cloud resources. In turn, this minimizes latency for users, no matter where they’re located. This feature also works to reduce the burden of database management, which frees up time to focus on other priorities.
3- High performance
A NoSQL database’s scale-out architecture might be especially helpful when traffic or data volume rises. This architecture guarantees single-digit millisecond response times that are both predictable and quick, as illustrated in the image below. NoSQL databases are utilized in applications that need to provide a highly interactive user experience but also collect terabytes of data every day since they can consume data and distribute it fast and reliably. The next figure illustrates two different incoming rates: 150 writes per second (green line) and 300 reads per second (blue line) with 95th latency values in the 3–4 ms region.
4- Highly Functional
Distributed data stores with very high data storage requirements are the target market for NoSQL databases. Because of this, NoSQL is the best option for applications with huge data, real-time web apps, customer 360, online gaming, online shopping, the Internet of things, social networks, and online advertising.
5- flexability
Data is stored in a much more strict, specified structure when using SQL databases. However, NoSQL eliminates the need for those strict schemas and allows for more flexible data storage. Innovation and quick application development are made possible by this design. Without having to worry about schemas, developers can concentrate on building solutions that will better serve their clients. Any type of data, including unstructured, semi-structured, and structured data, can be readily handled by NoSQL databases in a single data repository.
Disadvantages of NoSQL
1- Management Challenge:
Big data management in NoSQL is much more complex than a relational database.
2- Backup:
it is a great weak point for some NoSQL
When should use NoSQL
1- The relationship between the data you store is not that important.
2- data changes over time and is not structured
Reference
https://www.mongodb.com/resources/basics/databases/nosql-explained
Unlock the Potential of Your Business with AIT Systems
From web development to mobile app solutions, AIT Systems turns your ideas into reality. Let’s build something great together.
https://www.coursera.org/articles/nosql-vs-sql
SQL The Complete Reference, Third Edition. Weinberg Paul, Groff James, Oppel Andrew
A Relational Model of Data for Large Shared Data Banks , E. F. CODD,1970
Database systems, C.foster,Elvis.
M.Sc. (Computer Science) Sem-I Database Technologies Chapter 1 Introduction to NOSQL.
Unlock the Potential of Your Business with AIT Systems
From web development to mobile app solutions, AIT Systems turns your ideas into reality. Let’s build something great together.