SQL Vs NoSQL Flashcards

(16 cards)

1
Q

What are the two most common types of databases? How do they differ?

A

Relational (SQL) and non-relational (NoSQL) databases.

Relational databases are structured and have well-defined schemas. Non-relational are unstructured, distributed and have a dynamic schema.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does a relational database store data?

A

Data is stored in rows and columns (tables) where each cell represents a single data point.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the four most common types of non-relational databases?

A

Document databases, graph databases, key-value stores, and wide-column / columnar databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a key-value store? What’s a popular option?

A

A key-value store, as the name implies, links a single attribute (key) with an associated value. Redis is probably the most popular option, along with Dynamo.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a document database? What’s a popular example of one?

A

A document database stores individual documents with unstructured schemas, which are grouped together in collections. Each document is flexible and can have its own distinct structure/schema.

MongoDB and CouchDB are two of the most popular options.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a wide-column or columnar database? What’s are popular options?

A

Wide-column databases use column families instead of tables, which function as containers for rows which do not require the same number of columns in each.

Cassandra or HBase are the most popular options.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are graph databases? What’s are some popular options of them?

A

Graph databases store data whose relationships are best reflected in a graph structures broken up into nodes (entities), properties (information about the entity) and lines (connections between entities).

Neo4J and InfiniteGraph are two popular options.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does storage differ from relational to non-relational?

A

Relational databases store all data in rows and columns. Non-relational can vary depending on the flavor of non-relational (key-value, document, graph, etc.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What role does schema play in relational databases? What about non-relational?

A

In relational databases (SQL), data is required to adhere to defined schemas, which must be defined before data entry.

Non-relational stores have dynamic schema and can be changed on the fly, and data is not required to adhere to a specific shape.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does querying differ between relational and non-relational stores?

A

Relational databases generally use SQL (structured query language) to perform queries.

Non-relational are typically based on collection queries or an UnQL (unstructured query language). Syntax can vary depending on the technology and database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do relational and non-relatioanl stores scale?

A

Relational data stores typically scale well vertically, and while they can scale horizontally to be distributed, it typically involves complexity.

Non-relational stores will typically scale horizontally out of the box, and many technologies will handle the distribution across servers automatically.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Regarding reliability, how do relational and non-relational stores differ?

A

Relational data stores are generally ACID-compliant, so they are the best option for reliability and guarantees around transactions.

Non-relational stores typically sacrifice ACID for performance.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is ACID compliance? Why is it important?

A

ACID stands for:
- Atomicity (operation is binary)
- Consistency (data integrity)
- Isolation (independent operations)
- Durability (fault tolerant)

All of these guarantees ensure the data is safely written.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are two reasons to choose a relational data store over a non-relational?

A

ACID compliance and structured or unchanging data:

Firstly, the need for extremely strong consistency and reliability guarantees provided by ACID compliance and its transactions.

Secondly, the presence of unstructured and unchanging data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What industries would likely choose a relational database?

A

E-commerce or finance (due to ACID and very structured data)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are three reasons to use a non-relational database?

A

Storing large volumes of unstructured data, native horizontal scaling, and rapid deployment (since data is unstructured and requires no preparation before writing or guaranteeing around reads)