2. SQL and Databases Flashcards

1
Q

What are the differences between OLTP and OLAP systems?

A

OLTP (Online Transaction Processing) systems are optimized for managing transaction-oriented applications, while OLAP (Online Analytical Processing) systems are designed for complex queries and data analysis.

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

What is indexing in databases, and how does it improve performance?

A

Indexing is a data structure technique that improves the speed of data retrieval operations on a database table. It allows the database to find data faster without scanning the entire table.

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

Explain the concept of normalization and denormalization.

A

Normalization is the process of organizing data to reduce redundancy, while denormalization is the process of combining tables to improve read performance at the cost of increased redundancy.

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

How do you optimize complex SQL queries?

A

Optimizing complex SQL queries can involve indexing, rewriting queries for efficiency, reducing the number of joins, and using appropriate filtering and aggregation.

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

What is a clustered vs. non-clustered index?

A

A clustered index determines the physical order of data in a table, while a non-clustered index is a separate structure that points to the physical data.

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

What is a materialized view, and how does it differ from a regular view?

A

A materialized view is a database object that contains the results of a query and is stored on disk, whereas a regular view is a virtual table that does not store data.

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

How do you handle duplicates in SQL data?

A

Duplicates in SQL data can be handled using the DISTINCT keyword, GROUP BY clause, or by using the ROW_NUMBER() function to identify and remove duplicates.

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

Explain ACID properties in a relational database.

A

ACID properties ensure that database transactions are processed reliably: Atomicity, Consistency, Isolation, and Durability.

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

What is the difference between UNION and UNION ALL?

A

UNION combines the results of two queries and removes duplicates, while UNION ALL combines the results and includes all duplicates.

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

How does partitioning improve query performance?

A

Partitioning improves query performance by dividing a large table into smaller, more manageable pieces, allowing for faster data access and maintenance.

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