Sunteți pe pagina 1din 14

Table of Contents

Introduction ............................................................................................................................................. 2

ACID Properties of SQL ..................................................................................................................... 3

BASE (Basically, Available, Soft state Eventually Consistent) ......................................................... 3

Types of SQL & NoSQL databases ........................................................................................................ 4

SQL Databases .................................................................................................................................... 4

MySQL Community Edition........................................................................................................... 4

MS-SQL Server Express Edition: ................................................................................................... 4

Oracle 11g Express Edition Database: ............................................................................................ 4

NoSQL Databases ............................................................................................................................... 6

Key-Value Store Databases ............................................................................................................ 6

Column-Oriented Databases ........................................................................................................... 6

Document Store Databases ............................................................................................................. 7

Object-Oriented Databases ................................................................................................................. 7

Db4o................................................................................................................................................ 7

Comparison between SQL & NoSQL databases .................................................................................... 8

Applications .......................................................................................................................................... 10

Advantages & Disadvantages of using SQL & NoSQL ....................................................................... 10

Testing SQL and NoSQL databases...................................................................................................... 11

SQL Testing ...................................................................................................................................... 11

NoSQL Testing ................................................................................................................................. 11

Example of SQL and NoSQL queries ................................................................................................... 12

References ............................................................................................................................................. 13

1
Introduction

The fast growth of computer and web cause an issue of effective storage and retrieval of data.
Significant amounts of online transactions and research result in huge amounts of data which
require well-organized storage solutions. A SQL database is a general-purpose relational
database which based on relation tables to store data. A relation table consists of sets of
columns and rows. Each row accounts for a record, and each column represents a field. Tables
can be related and linked to each other with the use of foreign keys or common columns.

Google, Amazon and Facebook are among the main organisations to find the constraints of
SQL database innovation for supporting large data. In this way, the new database is framed to
beat these confinements which are known as NoSQL. A vital component of NoSQL database
which stands out is that they have no schematic structure. Its records can have diverse fields
according to the prerequisites, and this is called as a dynamic pattern. Sharding is another new
component in NoSQL databases which takes Database Partitioning to a more advanced level
as even adaptability and accessibility. The drawbacks of NoSQL databases are the absence of
RDBMS support for end client querying, restricted integrity requirements like a foreign key at
the structure level and limited support for transaction processing.

2
ACID Properties of SQL

SQL databases support ACID in the transaction. ACID (Atomicity, Consistency, Isolation,
and Durability) is database transaction properties. Each of the ACID property is explained in
the context of databases as follows:

Atomicity When there are updates to the database, it should be either abort or commit.

Consistency A transaction either creates a valid and new state of data. All data should
return to its state before the transaction was started if any failure occurs.
Isolation Each transaction must remain isolated, so there is no conflict between
concurrent transactions.
Durability Committed data is saved by the system such that, even when there are a
system failure or system restart, the data is available in its correct state.

BASE (Basically, Available, Soft-state Eventually Consistent)

BASE is the exact opposite of ACID. The state of data that gets after the transaction is not in
a solid state but in a soft state. The BASE mainly focuses on permanent availability.

No schema required: - Data can be stored in a NoSQL database without pre-defining


database schema. The structure of the information being embedded can be adjusted
whenever, without application intrusion.
Auto elasticity: - Without the requirement of application assistance, NoSQL
automatically distributes the data to multiple servers.
Integrated caching: - In order to increase data through and increase the performance
NoSQL databases cache the data in system memory.
CAP Theorem: - CAP Theorem consists of Consistency, Availability and Partition-
tolerance.

3
Types of SQL & NoSQL databases
SQL Databases

MySQL MySQL Database is a popular open-source database. It is usually being


Community
Edition used with Apache and PHP, although it can also be used with server-
side Java scripting technique using NodeJS.

Replication: MySQL database is replicated across multiple hosts and


servers so that the workload can be reduced heavily.

Sharding: MySQL Sharding operating system is helpful when there is


a huge number of write operations needs to be performed on a high
traffic website.
MS-SQL Server MS-SQL is a product of Microsoft having excellent reliability,
Express Edition:
scalability, stability features.

IDE support: For efficient development and to increase the


productivity.

Disaster Recovery mechanism: By providing database mirroring


mechanism, MS-SQL provides efficient disaster recovery mechanism
by using failover clustering technique.

Cloud backup support: Microsoft also provides MS-SQL database


back-ups in cloud storage.
Oracle 11g This database is an entry-level, small-footprint database for
Express Edition
Database: development, deployment, and distribute. It has a simpler
administration.

Easily Upgrade: Oracle database can be upgraded to the new and


advanced versions easily.

4
Vast platform support: It supports numerous operating systems such
as Windows and Linux.

Scalability: Oracle database provides not cost effective scalability. It


also provides the facilities which are easily manageable. Besides, it's
productive also secure and reliable.

5
NoSQL Databases

Key-Value Store Databases

A Key-Value Store database is a type of NoSQL databases. It has no fixed schema (Schema-
less). Like the name, the Key-Value database consists of two parts, a string which shows the
key and the actual data which shows the values. The KV databases are like hash tables where
the keys are used as indexes. KV databases are relatively quicker than RDBMS.

Amazon It is designed especially for internet scale applications. It provides


DynamoDB highly reliable, fast and cost-effective service of NoSQL database. It
stores data on Solid State Drives.
Riak Riak is a free distributed NoSQL database which offers partition
tolerance as well as persistence.

Column-Oriented Databases

Data stored in Column-Oriented Databases in the form of the whole column rather than a
row. This decreases the disk access compared to a relational table, which consists of column
and rows with uniform sized fields for every record.

HBase HBase provides BigTable- like capability for Hadoop as it is modelled


as a part of Apache Software Foundations Apache Hadoop Project. It is
also run on top of Hadoop Distributed File system i.e. HDFS. HBase
features include in-memory operation, compression and Bloom filters
on a per column basis. Several data-driven websites like Facebooks
Messaging are now serving by HBase.
Cassandra Some of the features of Cassandra are a dynamic schema, partition
tolerance, high availability, persistence, high scalability, etc.
Applications that use Cassandra are banking and finance, social
networking websites and real-time data analytics, etc. Cassandra is also
used by Adobe, Twitter, eBay, etc. The drawback of Cassandra is that
read operations are comparatively slower than write operations.

6
Document Store Databases

Document Store Databases saves the data in the form of documents. Document Store
databases are schema-less, so they are much more flexible compared to the records in
relational databases. Format of documents are PDF, XML, JSON etc.

MongoDB MongoDB stores the documents in BSON format which is a binary


form of JSON. BSON supports different data types such as integer,
float, string, Boolean, date, etc. MongoDB is schema-less as it has
document structure
CouchDB For storage of data, it uses JSON documents as well as to create and
update database documents, CouchDB provides RESTful HTTP API.
Disadvantages of CouchDB are no support for ad-hoc queries,
temporary views in CouchDB are very slow on large datasets

Object-Oriented Databases

Object Oriented databases the data to be stored is represented as an object. Object Oriented
database is a combination of object oriented programming and database characteristics.

Db4o SQL. Db4o allows the user to store an object in a single query. It also
offers db4o Replication System that allows synchronising relational
backend with db4o. The disadvantage of db4o is that there is no built-in
support to export or import data from JSON, XML.

7
Comparison between SQL & NoSQL databases

Schemas and In SQL databases, each record conforms to fixed schematic representation,
Flexibility meaning the columns must be locked before data. In SQL databases, each
record adjusts to settled schematic portrayal, which means the columns
must be chosen and locked before information passage and each line must
contain information for every column. (Ameya N, Anil P, Dikshay P)
Scalability SQL Databases are scalable. RDBMS can be applied across several
servers, but this one of the problematic processes and time-consuming
method. NoSQL databases are parallel accessible, meaning across servers.
These multiple servers can be inexpensive commodity hardware or cloud
instances, making it a lot more cost-effective than vertical scaling. Many
NoSQL databases also distribute data across servers automatically.
ACID The majority of SQL databases are ACID compliant. Differs between
Compliancy technologies, but most NoSQL solutions sacrifice ACID compliance for
performance and scalability.
Type of data to The SQL databases are not suitable for hierarchical data storage. NoSQL
be stored database is comparatively better for the hierarchical data storage as it
follows the key-value pair way of storing data content which is like JSON
data. NoSQL databases are ideal for applications involving big data. An
example is HBase.
For complex SQL databases are a good fit for the complex queries; whereas NoSQL
queries databases are not a good fit for complex queries. On a high-level, NoSQL
does not provide standard interfaces to perform complex queries, and the
NoSQL queries are not as powerful as SQL query language.
For high SQL databases are more suitable for value-based applications. This
transactional because SQL databases are steadier and give the atomicity and also
based uprightness of the information. While it is conceivable to utilise NoSQL
application for exchanges reason yet, it is as yet not practically available and efficient
in high load and complex transactional applications.
Data Data manipulation activities in SQL databases is done by using Selection,
manipulation Insertion, and Update statements, e.g. SELECT column_name FROM

8
table_name WHERE condition In NoSQL databases, data manipulation
is done using different object-oriented APIs.

9
Applications

NOSQL databases are most widely used in online applications. It is still no much used in
standalone database applications. There is some organised way needs to be implemented for
NOSQL databases so that it can completely ready to replace RDBMS. SQL databases can be
used for all types of applications. However, the performance may vary according to the amount
of data stored. (digitalocean.com, 2017)

Advantages & Disadvantages of using SQL & NoSQL

SQL NoSQL
Stores data in table form Stores related data in JSON-like,
Schema is required to defines tables name-value documents
(www.sitepoint.com) Can store data without specifying
Encourages normalisation to reduce data a schema
redundancy Should not require join operations
Provides transactions to guarantee two (presuming denormalized
or more updates succeed or fail as an documents are used)
atomic unit Permits any data to be saved
Supports table joins to retrieve data from anywhere at any time without any
multiple tables in a single command verification
Implements data integrity rules Guarantees updates to a single
Has a tendency to come grinding to a document but not multiple
halt if its forced to deal with too many documents
operations at a given time. Provides excellent performance
Have lots of talented developers and scalability
throughout the market and in every field Because NoSQL databases are
of trade. still new, nearly every NoSQL
developers are still in the process
of mastering the technique.

10
Testing SQL and NoSQL databases

SQL Testing

Black-Box Testing White/Clear-Box Testing


O/R mappings (including the Scaffolding code (e.g. triggers or
metadata) updateable views) which support
Incoming and outgoing data values refactoring
(from queries, stored functions, Unit tests for your functions, triggers
views) (agiledata.org, 2017) and stored procedures
Existence tests for database schema
elements (tables, procedures)
View definitions
Referential integrity (RI) rules
Default values for a column
Data invariants for a single column
Data invariants involving several
columns

NoSQL Testing

NoSQLUNit which is a JUnit extension that able to connect with a broad range of NoSQL
databases like Cassandra, MongoDB, Redis and more. It also enables you to load the test data
before the test execution and compare the data sets after the test execution with few lines of
code. (blog.codecentric.de, 2017)

11
Example of SQL and NoSQL queries

Query Relational Database MongoDB


Create Command CREATE TABLE No need for defining schema
table_name (column name1
datatype, column_name2
datatype)
Insert Command INSERT INTO table db.collection_name. insert (
table_name (column_name1, { name1: value1, name2:
column_name2) VALUES ( value2} )
value1,value2)
Delete Command DELETE FROM db.collection_name.rem ove
table_name WHERE ({condition})
(condition)
Import command BULK INSERT table_name mongoimport --db
FROM file_name WITH { database_name -- collection
FIELDTERMINATO R =,, collection_name --type csv -
ROWTERMINATOR =\n -file file_name
} GO
Select Command SELECT column_name db.collection_name({},
FROM table_name {condition})
Table 1 Taken from (Divya Chauhan, K. L Bansal)

12
References

International Journal of Advanced Research in Computer Science and Software Engineering,


SQL and NoSQL Databases by Vatika Sharma, Meenu Dave.

International Journal of Applied Information Systems (IJAIS), Types of NOSQL Databases


and its Comparison with Relational Databases by Ameya Nayak, Anil Poriya, Dikshay
Poojary.

International Journal of Science & Engineering Research, Modeling and Querying Data in
MongoDB by Rupali Arora, Rinkle Rani Aggarwal SQL vs. NoSQL Databases Differences
Explained with few Examples DB by LUKE P. ISSAC on JANUARY 14,2014.

Issac, L.P., 2014, SQL vs. NoSQL Database Differences Explained with few Example DB
[Online]. Available at: http://www.thegeekstuff.com/2014/01/sql-vs-nosql-db/ [Accessed: 1
July 2017].

International Journal on Recent and Innovation Trends in Computing and Communication


ISSN: 2321-8169, Using the Advantages of NOSQL: A Case Study on MongoDB by Divya
Chauhan and K. L. Bansal

RDBMS vs. NoSQL: Performance and Scaling Comparison by Christoforos Hadjigeorgiou


http://static.ph.ed.ac.uk/dissertations/hpc-msc/2012-2013/RDBMS%20vs%20NoSQL%20-
%20Performance%20and%20Scaling%20Comparison.pdf

Anon, 2015, Difference between SQL and NoSQL: A Comparison [Online]. Available at:
http://www.thewindowsclub.com/difference-sql-nosql-comparision [Accessed: 3 July 2017].

D.O., Contents [Online]. Available at:


https://www.digitalocean.com/community/tutorials/understanding-sql-and-nosql-databases-
and-different-database-models [Accessed: 3 July 2017]

Anon, Database Testing: How to Regression Test a Relational Database [Online]. Available
at: http://www.agiledata.org/essays/databaseTesting.html [Accessed: 3 July 2017].

13
Anon, 2014, Test Automation for NoSQL Databases with NoSQL Unit and Travis-CI
[Online]. Available at: https://blog.codecentric.de/en/2014/05/nosql-test-automation-
nosqlunit-travis-ci/ [Accessed: 3 July 2017].

Anon, 2015, Advantages and Disadvantages of NoSQL databases what you should know
[Online]. Available at: http://www.hadoop360.datasciencecentral.com/blog/advantages-and-
disadvantages-of-nosql-databases-what-you-should-k [Accessed: 3 July 2017].

14

S-ar putea să vă placă și