SQL vs NOSQL Flashcards
when to choose a database
What is the primary structure of SQL databases?
Relational databases with tables, rows, and columns
SQL databases store data in a structured format, similar to a spreadsheet.
What does ACID stand for in the context of SQL databases?
Atomicity, Consistency, Isolation, Durability
These properties ensure strong data integrity in SQL databases.
Name three examples of SQL databases.
- MySQL
- PostgreSQL
- Oracle
These are common relational database management systems.
How do NoSQL databases differ from SQL databases in terms of schema?
NoSQL databases are schema-less or schema-flexible
This allows for easier changes to data structure without predefined schema.
What is the primary querying language used in SQL databases?
SQL (Structured Query Language)
SQL allows for complex queries, including joins and aggregations.
What does BASE stand for in NoSQL databases?
Basically Available, Soft state, Eventually consistent
This model prioritizes availability over strict consistency.
What is a key advantage of NoSQL databases?
Highly scalable and flexible schema
NoSQL databases can handle large, distributed data sets more easily.
What type of scalability do SQL databases typically use?
Vertical scalability
This involves increasing the hardware capacity of the server.
What type of scalability do NoSQL databases typically use?
Horizontal scalability
This allows adding more servers to handle larger loads.
In what scenarios are SQL databases best suited?
- Transactional applications
- Applications requiring strong consistency
- Well-defined data structures
Examples include banking, e-commerce, and CRM systems.
List two types of NoSQL databases.
- Document-based (e.g., MongoDB)
- Key-value (e.g., Redis)
These types illustrate the variety in NoSQL database structures.
True or False: NoSQL databases are typically better for complex relationships.
False
SQL databases are designed for complex relationships using foreign keys and joins.
Fill in the blank: SQL databases are __________, meaning they store data in a predefined schema.
relational
This structure is essential for maintaining complex relationships in data.
What is a disadvantage of SQL databases?
Difficult to scale horizontally
SQL databases primarily rely on vertical scaling, which has limitations.
What is a disadvantage of NoSQL databases?
Lack of consistency may lead to data integrity issues
The BASE model can compromise strict consistency.
What type of applications are NoSQL databases suitable for?
- Big data applications
- Real-time analytics
- Rapidly evolving applications
Examples include social media platforms and IoT systems.
What is the performance characteristic of NoSQL databases?
Optimized for high throughput and low-latency access
This makes them suitable for scenarios with frequent reads and writes.
What is a common use case for SQL databases?
Applications requiring strong consistency and complex transactions
Common in banking and financial services.
True or False: SQL databases can easily adapt to changes in data structure.
False
Changes to schema in SQL databases can be complex and require migrations.
What is an example of a document-based NoSQL database?
MongoDB
MongoDB stores data in flexible, JSON-like documents.
How do SQL and NoSQL databases differ in handling data relationships?
SQL handles complex relationships with foreign keys and joins; NoSQL is less focused on relationships
NoSQL often stores denormalized data.
What can be said about the querying capabilities of NoSQL databases?
Limited querying capabilities compared to SQL, especially for complex joins
While some NoSQL databases like MongoDB support limited joins, they are generally less powerful.