DA0-002 practice question 25 of 25

[Data Acquisition and Preparation]A data analyst is gathering data from multiple tables in a database. The analyst needs certain columns from each…

Full set: 111 questions

[Data Acquisition and Preparation]

A data analyst is gathering data from multiple tables in a database. The analyst needs certain columns from each table. Which of the following is the best method to accomplish this task?

Answer options
A: Aggregate
B: Union
C: Nest
D: Join Correct answer
Correct Answer:
D. Join
Explanation

A JOIN operation is the standard and most efficient method in relational databases for combining rows from two or more tables based on a related column. This operation allows an analyst to create a new, temporary table (a result set) that includes selected columns from each of the original tables. This directly addresses the analyst's need to gather specific columns from multiple tables into a single view for analysis. Different types of joins (e.g., INNER, LEFT, RIGHT, FULL) provide flexibility in how to handle records that may not have a match in the other table.

Why Incorrect

A. Aggregate: Aggregation functions (e.g., SUM, COUNT, AVG) are used to perform a calculation on a set of rows and return a single summary value, not to combine columns.
B. Union: A UNION operation combines the result sets of two or more queries by stacking the rows vertically. It requires the queries to have the same number of columns.
C. Nest: Nesting involves creating a hierarchical or complex data structure within a single column (e.g., a JSON object), which is not the standard method for combining columns from different tables.

References

1. Microsoft Corporation. (2023). FROM clause plus JOIN, APPLY, PIVOT (Transact-SQL). Microsoft SQL Server Technical Documentation. In the "Joins" section, it states, "A join is an operation that combines rows from two or more tables to create a new, combined row that can be used by the query."

2. PostgreSQL Global Development Group. (2024). PostgreSQL 16 Documentation. Section 7.2.1.3, "Joins Between Tables". The documentation explains, "tables can be joined... This allows you to combine columns from different tables in the output."

3. Ullman, J. D., & Widom, J. (n.d.). CS145 Introduction to Databases: Lecture 3 - Relational Algebra. Stanford University. In the section on "Natural Join," the operation is defined as the primary way to combine tuples (rows) from two relations (tables) that share common attributes (columns).

4. Oracle Corporation. (2024). Oracle Database SQL Language Reference, 23c. "Joins" section. The documentation states, "A join is a query that combines rows from two or more tables, views, or materialized views."

Scroll to Top