Understanding Databases Flashcards

(17 cards)

1
Q

What is a database and what are its three main purposes?

A

A structured data storage system designed to allow for: 1. Ease of data accessibility, 2. Data manipulation, 3. Data manageability

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

What are structured and unstructured data? Give 2 examples of each with explanations.

A

Structured: Data organized in tables - relational customer records (Name/Email fields), Excel employee spreadsheets (salary/department columns). Unstructured: No fixed format - social media posts (mixed text/images/videos), scanned PDF contracts (can’t be directly queried)

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

Classify these data types: quarterly sales report with Date/Salesperson/Revenue columns vs MP3 customer service recordings. Explain your reasoning.

A

Sales report: Structured (defined columns, consistent format). MP3 recordings: Unstructured (audio files with no structured metadata that can’t fit in database tables)

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

What does ACID stand for and define each property?

A

Atomicity (transactions are all-or-nothing), Consistency (data remains valid before/after transactions), Isolation (transactions don’t interfere with each other), Durability (completed transactions are permanently saved)

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

Explain atomicity with a banking transfer example. What happens if the transfer fails halfway?

A

Either the complete transaction succeeds (money debited AND credited) or the entire transaction is aborted. If it fails halfway, the system rolls back all changes to prevent partial completion

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

What does consistency prevent? Give a concrete example of what could go wrong without it.

A

Prevents invalid data states. Without consistency: bank accounts could show negative balances when overdrafts aren’t allowed, or inventory could display -5 items in stock

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

Two users simultaneously update the same customer record. How does isolation prevent problems?

A

Isolation ensures each transaction acts as if it’s the only one running, preventing data corruption from simultaneous modifications through proper transaction sequencing

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

Your database crashes immediately after completing a transaction. What does durability guarantee?

A

Durability guarantees that completed transactions survive system failures, crashes, or power outages - all changes are permanently saved

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

How do databases provide better data integrity than file systems?

A

Databases enforce constraints and ACID properties to validate data, while file systems save whatever is entered without validation, even if there are errors or inconsistencies

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

Compare data retrieval efficiency between databases and file systems.

A

Databases use targeted queries for efficient data retrieval. File systems require scanning entire files to locate specific information, which is much slower and resource-intensive

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

What security advantages do databases have over file systems?

A

Databases provide authentication (user verification) and authorization (granular access permissions). File systems lack these built-in security controls

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

Give a specific example of how database constraints prevent errors that file systems cannot.

A

Example: Email field requiring valid format (@domain.com). Databases can enforce this rule and reject invalid entries like ‘notanemail’. File systems accept any data without validation

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

Name the four types of databases from your notes.

A
  1. Relational databases, 2. NoSQL databases, 3. Graph databases, 4. Object-Oriented databases
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

You need to store social connections (who knows whom) and analyze relationship patterns. Which database type is most appropriate and why?

A

Graph databases - specifically designed to handle relationships and connections between entities, making it efficient to query and analyze social networks and relationship patterns

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

A company stores employee records (ID, name, salary, department) and needs complex reporting. Which database type and what are two key advantages?

A

Relational database. Advantages: 1. Perfect structure for defined relationships between data fields, 2. Supports complex SQL queries for detailed analysis and reporting

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

An e-commerce transaction deducts inventory but fails before charging the customer. Which ACID property prevents this issue and what should happen?

A

Atomicity prevents this. Since the complete transaction (inventory deduction + payment) didn’t succeed, the system should roll back and restore inventory to its original level

17
Q

You’re designing storage for: customer names, order timestamps, product review text, and product photos. Categorize each and justify your reasoning.

A

Structured: Customer names (fixed field format), order timestamps (standardized datetime format). Unstructured: Review text (free-form content), product photos (image files) - these lack predefined structure for database tables