Database Flashcards
What are the two general types of databases?
SQL (Relational) and NoSQL (Sometimes known as blob or key:value)
What are the features of a SQL Database?
SQL databases organize data into tables where columns represent attributes and rows represent records.
SQL databases are relational, allowing logical linking between data/tables.
SQL databases require a defined schema/structured data
SQL databases provide strong ACID guarantees
What are the features of a NoSQL Database?
NoSQL databases use non-relational semi/non structured data.
NoSQL databases are designed to be more flexible than relational databases.
NoSQL databases usually do not provide strong ACID guarantees as a trade off for speed/scaling.
What are the main differences between SQL and NoSQL databases?
Relational - SQL databases are relational (Tables where rows represent records and columns attributes, linked by logical relationships), NoSQL is generally not relational.
Schema - SQL databases are structued and have a pre-defined schema, NoSQL allows for dynamic schemas/unstructured data.
Scaling - SQL scales vertically, NoSQL horizontally.
When would you choose NoSQL over SQL?
Flexibility - SQL requires a strict schema, NoSQL does not require this and can be better for unstructured data.
Speed - NoSQL scales horizontally and due to being loose on ACID properties, can often be much faster than SQL
Volume - Because of the horizontally scaling nature of NoSQL, it can be better at handling a large number of requests (SQL is blocking/scales vertically, so it can get bogged down)
What are the (4) most common types of NoSQL databases?
- Key-Value
- Column Stores
- Document
- Graph
Describe NoSQL Key Value Database
- A unique identifier key, paired with an unstructured data value.
- Optimized for reading/writing data at scale.
- Good for scenarios that require high-volume fast responses, and commonly used for in-memory data caching.
Examples
DynamoDB
Describe NoSQL Columnar Database
- Data is indexed by columns instead of in rows.
- Good for data analytics as gathering all values for attributes requires scanning less rows.
- Can be very useful for real-time analytics or time-series data
Examples
Redshift
Describe NoSQL Document Database
- Data is stored in documents (Like JSON, YAML, CSV) instead of tables and rows
- Documents are semi-structured data, that can evolve as the application changes.
- Good for scenarios with frequently changing data, and scaling being primary concerns.
Usecases
* Content Management
* Sensor Data
* IoT
Examples
MongoDB
Describe NoSQL Graph Database
Specialized database that stores data as a network of connected nodes/edges. Nodes represent data/entities, edges represent the relationships between them. Prioritizes connections rather than data.
Usecases
* Social Networks
* Recommendation Systems