NoSQL Interview Questions and Answers, Introduction to NoSQL Databases, SQL vs. NoSQL, Big Data Technology, and Advantages & Drawbacks of NoSQL Databases.
NoSQL databases emerged in the late 2000s as the cost of storage dramatically decreased.
NoSQL Interview Questions and Answers
1. What is NoSQL?
NoSQL databases (aka “Not Only SQL”) are non-relational databases and store data differently than relational tables.
NoSQL databases come in a variety of types based on their data model. The main types are document, key-value, wide-column, and graph.
NoSQL provides flexible schemas and scales easily with large amounts of data and high user loads.
2. What are the features of NoSQL?
NoSQL databases have the following properties:
- They have higher scalability.
- They use distributed computing.
- They are cost-effective.
- They support flexible schema.
- They can process both unstructured and semi-structured data.
- There are no complex relationships, such as the ones between tables in an RDBMS.
3. What are the different types of NoSQL databases?
NoSQL Databases are mainly categorized into four types: Key-value pair, Column-oriented, Graph-based and Document-oriented. Every category has its unique attributes and limitations. None of the above-specified databases is better to solve all the problems. Users should select the database based on their product needs.
Types of NoSQL Databases:
- Key-value Pair Based
- Column-oriented Graph
- Graphs based
4. When Would You Want to Use NoSQL over SQL?
- The pace of development with NoSQL databases can be much faster than with a SQL database.
- The structure of many different forms of data is more easily handled and evolved with a NoSQL database.
- NoSQL databases are often better suited to storing and modeling structured, semi-structured, and unstructured data in one database.
- The amount of data in many applications cannot be served affordably by a SQL database.
- The scale of traffic and the need for zero downtime cannot be handled by SQL.
- The scalability of NoSQL databases allows one database to serve both transactional and analytical workloads from the same database.
- NoSQL databases often have superior integration with real-time streaming technologies.
5. What are the Advantages of NoSQL?
- Can be used as Primary or Analytic Data Source
- Big Data Capability
- No Single Point of Failure
- Easy Replication
- No Need for Separate Caching Layer
- It provides fast performance and horizontal scalability.
- Can handle structured, semi-structured, and unstructured data with equal effect
- Object-oriented programming which is easy to use and flexible
- NoSQL databases don’t need a dedicated high-performance server
- Support Key Developer Languages and Platforms
- Simple to implement than using RDBMS
- It can serve as the primary data source for online applications.
- Handles big data which manages data velocity, variety, volume, and complexity
- Excels at distributed database and multi-data center operations
- Eliminates the need for a specific caching layer to store data
- Offers a flexible schema design that can easily be altered without downtime or service disruption
6. What are the Drawbacks of NoSQL?
- There is no common, standardized query language as there is in SQL for relational databases.
- NoSQL databases typically do not enforce data constraints in the server, leaving you to code data constraints in your application. This requires a lot of repetitive work for developers, and creates opportunities for dumb bugs.
- NoSQL databases typically do not support ACID properties. You don’t have transactions. You don’t have consistency enforcement (i.e. constraints). You don’t have atomic changes. You don’t have durability.
- NoSQL databases don’t support data modeling in the traditional sense. There are no normal forms. There are not logical data models. You have only physical layout of data, and that limits the types of queries that can be run efficiently.
- NoSQL databases are typically much younger than RDBMS technology, which makes them tend to make significant changes from time to time as they evolve. This can break backward compatibility and make relatively recent software releases become unsupported.
- Database operations may not be very well thought out yet. Some NoSQL databases have no secure authentication. Some have no failover solution. Some have no backup solution. As they add those features, the “simplicity” they once boasted about becomes less of a selling point.
7. Does NoSQL Database Interact With Oracle (SQL) Database?
NoSQL Database supports retrieving records through the Oracle Database External Table functions. This makes it possible to perform some queries from Oracle Database and retrieve records from NoSQL Database.
8. When should we use a NoSQL database instead of a SQL Database (relational database)?
A relational database enforces ACID. So, you will have schema-based transaction-oriented data stores. It’s proven and suitable for 99% of real-world applications. You can practically do anything with relational databases. But, there are limitations on speed and scaling when it comes to massive high availability data stores.
For example, Google and Amazon have terabytes of data stored in big data centers. Querying and inserting are not per formant in these scenarios because of the blocking/schema/transaction nature of the RDBMS.
9. What is DocumentDB?
When you are working on some application that needs to handle data with changing schema or you are not sure about the data which you need to work with and how much data the application needs to handle. You are also not sure about the structure of the data. You also need scalability, low cost, and fast deployment for your data. In all these scenarios we consider DocumentDB.
There are many DocumentDB services as below.
- Microsoft Azure Cosmos DB
- Amazon DocumentDB
10. What is Big SQL?
IBM Big SQL is a high-performance massively parallel processing (MPP) SQL engine for Hadoop that makes querying enterprise data from across the organization an easy and secure experience.
A Big SQL query can quickly access a variety of data sources including HDFS, RDBMS, NoSQL databases, object stores, and WebHDFS by using a single database connection or single query for best-in-class analytic capabilities.
11. What are popular SQL Databases and NoSQL Databases?
Popular SQL/Relational Databases – Oracle, MySQL, MS SQL Server, PostgreSQL, IBM DB2, Etc,
Popular NoSQL/Non-Relational Databases –
1. Document-Based NoSQL Databases – MongoDB, Orient DB, and BaseX
2. Key-Value Databases – DynamoDB, Redis, and Aerospike.
3. Wide Column-Based Databases – Cassandra and HBase.
4. Graph-Based Databases – Neo4j, Amazon Neptune, etc.
12. What is MongoDB?
MongoDB is the most widely used NoSQL – document-based database. It stores the documents in JSON objects.
According to a market survey, more than 3000 companies are using MongoDB in their tech stack. Uber, Google, eBay, Nokia, Coinbase are some of them.
13, When to use MongoDB?
In case you are planning to integrate hundreds of different data sources, the document-based model of MongoDB will be a great fit as it will provide a single unified view of the data.
14. What is Cassandra?
Apache Cassandra is an open-source NoSQL distributed database system (Wide Column-Based Database) that was initially built by Facebook (and motivated by Google’s Big Table). It is widely available and quite scalable. It can handle petabytes of information and thousands of concurrent requests per second.
15. When to use Apache Cassandra?
- When your use case requires more writing operations than reading ones
- In situations where you need more availability than consistency. For example, you can use it for social network websites but cannot use it for banking purposes
- You require less number of joins and aggregations in your queries to the database
- Health trackers, weather data, tracking of orders, and time-series data are some good use cases where you can use Cassandra databases
16. How does column-oriented NoSQL differ from document-oriented?
The main difference is that document stores (e.g. MongoDB and CouchDB) allow arbitrarily complex documents, i.e. subdocuments within subdocuments, lists with documents, etc. whereas column stores (e.g. Cassandra and HBase) only allow a fixed format, e.g. strict one-level or two-level dictionaries.