Relational Database Concepts Flashcards

(32 cards)

1
Q

What is a relational database?

A

A database that stores data in structured tables with relationships between tables.

Examples include Oracle, SQL Server, MySQL.

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

What is a Primary Key (PK)?

A

A column (or set of columns) that uniquely identifies each record in a table.

Example: EmployeeID in Employees table.

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

What is a Foreign Key (FK)?

A

A column that creates a relationship between two tables by linking to the primary key of another table.

Example: DepartmentID in Employees linking to Departments table.

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

What is database normalization?

A

Database normalization organizes tables to reduce redundancy and improve integrity.

Breaks data into related tables.

Follows “normal forms” like 1NF, 2NF, 3NF.

Goal: each data piece stored only once.

📖 Example: Separate Customers, Orders, and Products tables instead of repeating customer info.

Example: Moving repeated address fields into a separate Addresses table.

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

What is database denormalization?

A

Introducing redundancy to improve read performance.

Example: Adding DepartmentName directly into Employees table to avoid JOINs.

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

What is an INNER JOIN?

A

Combines rows from two tables only if they match on the join condition.

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

What is a LEFT JOIN?

A

Returns all rows from the left table, even if there’s no match in the right table.

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

Example of an INNER JOIN

A

SELECT * FROM Employees INNER JOIN Departments ON Employees.DepartmentID = Departments.ID;

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

Example of a LEFT JOIN

A

SELECT * FROM Employees LEFT JOIN Departments ON Employees.DepartmentID = Departments.ID;

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

What is an Index?

A

A database structure that speeds up data retrieval but can slow down writes.

Example: Indexing LastName for faster search queries.

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

What is a Transaction in databases?

A

A series of SQL operations that must be completed together, or not at all.

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

What are the ACID properties?

A

Atomicity, Consistency, Isolation, Durability — principles that guarantee reliable transactions.

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

What is a Query Execution Plan?

A

A report generated by the database showing how a SQL query will be executed.

Used for query optimization.

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

How to optimize a slow SQL query?

A

Add indexes on WHERE and JOIN columns, avoid SELECT *, use proper JOIN types, analyze execution plans.

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

What is Data Migration?

A

Moving data from a source system to a target system.

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

What are common issues during data migration?

A

Data type mismatches, missing data, encoding issues, duplicate records.

17
Q

What is ETL?

A

Extract → Transform → Load. Process of moving and modifying data during migration.

18
Q

Example of ETL process

A

Extract users from old CRM → Transform date formats to new system standards → Load into new CRM database.

19
Q

What is Data Mapping?

A

Defining how fields from source system map to fields in target system.

20
Q

Example of Data Mapping

A

Source: fname → Target: first_name; Source: phone_no → Target: phone_number.

21
Q

What is Data Reconciliation?

A

Comparing source and target systems to ensure data integrity after migration.

22
Q

How to perform Reconciliation?

A

Compare record counts, use checksum hashes, manually sample data entries.

23
Q

What is Interface Development?

A

Building connections between systems to exchange data (APIs, file-based transfers, database links).

24
Q

Example of an Interface

A

A REST API that sends customer order data from a website to a warehouse management system.

25
SOAP vs REST API?
SOAP uses XML + strict standards (WSDL); REST uses lightweight JSON and HTTP. REST is more common today.
26
How do you handle large data migrations?
Use batching (migrate small chunks), error recovery (retry failed records), logging, and validation scripts.
27
What is Idempotency in migrations/interfaces?
Guarantee that multiple identical requests have the same effect (important for retries). Example: sending the same record twice doesn't duplicate it.
28
File-based integration examples
Daily CSV upload of payroll data via SFTP; XML exports of customer orders to a third-party vendor.
29
Common tools for migrations
SQL scripts, Python (pandas for transformation), ETL tools (Talend, Informatica), API connectors.
30
What is a Non-Relational Database
Stores data in different formats (documents, key-value pairs, graphs, wide-columns). Relationships are often more flexible or even absent. Think NoSQL databases like MongoDB, DynamoDB.
31
What is a composite primary key in a relational database?
A composite primary key uses two or more columns together to uniquely identify a row in a table. Only one primary key constraint is allowed per table, but it can span multiple columns. None of the columns can be NULL. Common in many-to-many relationship tables (like student_id + course_id).
32