問題文
An analyst must list all products together with the number of orders each received, and products with no orders must appear with zero. Which combination of a join type and an aggregate handles the zero correctly?
選択肢
- A left join from products to orders with a count of all rows, because the unmatched product rows contribute nothing to a row count.
- A left join from products to orders with a count of a column from the orders side, because counting a column ignores the NULLs produced by unmatched rows.
- An inner join with a count of all rows, and a separate query to append the products that returned no rows with a literal zero.
- A full outer join with a count of all rows, because it keeps unmatched rows from both sides and therefore guarantees the zero.