CompTIA Tech+ (FC0-U71)Data and Database FundamentalsHard

A technician needs a report that lists each order along with the customer's name, but the Orders table only stores a CustomerID while the customer names are stored in a separate Customers table. Which SQL concept allows the technician to combine matching rows from both tables into a single result set?

  1. ARenaming the CustomerID column
  2. BJOIN
  3. CUNION of two SELECT results with no shared column
  4. DA second, unrelated WHERE clause
Show answer & explanation

Correct answer: B. JOIN

A JOIN combines rows from two or more tables based on a related column, such as matching Orders.CustomerID to Customers.CustomerID, allowing the report to display order details alongside the corresponding customer name in one result set.

Why the other options are wrong

  • A. Renaming a column changes only its label and does not connect data from another table.
  • C. UNION combines the results of two separate queries into one list, but it does not match related columns between tables.
  • D. An unrelated WHERE clause only filters rows within a single query and cannot merge data from two tables.

SQL JOIN

A SQL operation that combines rows from two or more tables based on a related column between them.

  • Common type is an INNER JOIN, which returns only matching rows from both tables.
  • Requires a shared column, often a foreign key referencing a primary key.
  • Allows queries to pull related data spread across multiple normalized tables.

Memory trick: JOIN is a zipper connecting two rows of teeth (tables) that match up.

More Data and Database Fundamentals questions