Chapter 2 - Data Models & Query Languages Flashcards

1
Q

Describe the relational data model

A

Data is organized into relations (called tables in SQL) where each relation is an unordered collection of tuples (rows in SQL)

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

What are the driving forces behind the adoption of NoSQL databases?

A
  • A need for greater scalability than relational databases can easly achieve including large datasets and high write throughput
  • Specialized query operations that are not well supported by the relational model
  • Desire for more dyanmic and expressive data models
  • Impedance mistmatch
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is impedance mismatch?

A

Impedance mismatch refers to the disconnect between object-oriented programming and relational databases. An awkward transition layer is required between the objects in the application code and the database model of tables, rows and columns.

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

What advantages does a JSON data model have over a relational data model?

A
  • Reduces impedance mismach
  • Better locality: If you want to fetch all the relevant information is in one place and one query is sufficient
  • Easier to edit schema: ALTER TABLE and UPDATE statements can take very long fr large tables as MySQL copies who table for ALTER TABLE and UPDATE must rewrite every row
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are some advantages of making a field an “ID” with the data stored in a separate table as oppose to a plain-text string?

A
  • Consistent spelling and style
  • Ease of update - string stored in one place so easy to update in one place
  • more…
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What disadvantages do JSON and other document databases have?

A

Poor support for many-to-many and many-to-one (e.g multiple people with the same school). The database will have either redundant data (data about the school stored in each object) or the developers will manally resolve references from one record to another.

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

In relational databases, what is the query optimizer?

A

The query optimizer automatically decides which parts of the query to execute in which order and which indexes to use.

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

What is the relational technique of shredding?

A

Shredding is splitting a document-like structure into multiple tables
It may lead to cumbersome schemas and unnecessarily complicate application code

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

What is the difference between and imperative and a declarative language and which is SQL?

A

An imperative language tells the computer to perform certain operations in a certain order. A declarative language specifies the pattern of data desires and conditions that must be met but not how to achieve that goals.
SQL is a declarative language.

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

What are the advantages of declarative query languages?

A

The database can move records around safely and make other similar optimisations without potentially breaking queries

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