DBMS Important Questions
DBMS Important Questions
SQL :
16. What is the difference between primary key and unique constraint?
19. What is a stored procedure? What are the benefits of stored procedures?
TRANSACTION :
Database Normalization:
51. SQL v/s NoSQL, explains with a use case when to use what
Answer: SQL (Structured Query Language) and NoSQL (Not Only SQL) are two different types of
database management systems, each with its own strengths and best use cases. The choice between SQL
and NoSQL depends on various factors, including the nature of the data, scalability requirements, and the
specific use case. Let's explore both options and provide a use case for each.
SQL Databases: SQL databases are based on the relational model and use structured tables with
predefined schemas to store and organize data. They provide ACID (Atomicity, Consistency, Isolation,
Durability) properties, ensuring data integrity and transactional consistency. SQL databases are suitable
for scenarios where data relationships are well-defined and structured.
Use Case for SQL: An e-commerce website is a typical use case for an SQL database. The website requires
structured data such as customer information, orders, products, and inventory. These relationships can be
efficiently represented in tables and queried using SQL queries. The ACID properties of SQL databases
ensure that the transactions, such as placing an order or updating inventory, are processed reliably and
consistently.
NoSQL Databases: NoSQL databases, on the other hand, are designed to handle unstructured, semi-
structured, or rapidly changing data. They offer flexible schemas and are highly scalable and distributed.
NoSQL databases relax some of the traditional ACID properties to provide high availability and horizontal
scalability. There are different types of NoSQL databases, including key-value stores, document databases,
columnar databases, and graph databases, each optimized for specific use cases.
Use Case for NoSQL: A social media analytics platform is a good example of a use case that can benefit
from a NoSQL database. The platform collects and analyzes large volumes of unstructured data, such as
social media posts, user interactions, and engagement metrics. These data sources often have varying
formats and can change frequently. NoSQL databases, such as a document store or a graph database,
allow for flexible schema design and efficient storage and retrieval of unstructured data. The scalability
and distributed nature of NoSQL databases enable handling high data volumes and accommodating the
dynamic nature of social media data.
In summary, SQL databases are ideal for scenarios with structured data and well-defined relationships,
such as traditional business applications, while NoSQL databases are suitable for handling unstructured or
rapidly changing data, such as social media analytics, content management systems, or IoT applications.
The choice between SQL and NoSQL depends on the specific requirements and characteristics of your
data and use case.