引导式测验 · 中等 等级
如何通过 AI 测验理解 SQL 连接
使用小型客户和订单示例练习内部和外部联接结果、多对多行乘法和过滤器放置。
问题 1 的 8
艾达有两个订单,而本没有。在进一步过滤之前,指南的客户到订单左连接产生了多少行?
预览每个问题8 问题
当您参加测验时,就会出现答案和解释。
- 艾达有两个订单,而本没有。在进一步过滤之前,指南的客户到订单左连接产生了多少行?
- Two, because only orders are counted
- One, because customer names are unique
- Three, including Ben's unmatched row
- Four, because every customer gets two rows
- 三个订单行和两个促销记录共享一个产品密钥。该键上的等式连接会产生多少个匹配组合?
- 六
- 五
- 三
- 两个
- 报告应包含每个客户一行,但连接当前为每个订单返回一行。在接受询问之前应该澄清什么?
- Whether sorting the result by customer removes the extra order rows
- Whether selecting fewer order columns alone changes the output grain
- Whether renaming the customer key makes it unique in the joined result
- The intended output grain and how order data should be aggregated
- 左连接应该保留未发货订单的客户。限制匹配已发货订单的条件可能属于哪里?
- In a WHERE condition that rejects all null right-side values
- In the ON condition that controls which orders match
- Only in the final ORDER BY clause
- In a DISTINCT operation after all orders have been joined
- 为什么在多对多连接后添加 DISTINCT 不是一个可靠的通用修复方法来解决总数膨胀的问题?
- DISTINCT establishes one row per customer regardless of which columns are selected
- DISTINCT makes each join-key value unique before matching occurs
- It may hide duplicate-looking results without correcting the matching or aggregation logic
- DISTINCT guarantees that an aggregate computed after the join used each source amount once
- Which join preserves unmatched rows from both input tables?
- A full outer join
- An inner join
- A left join in every table order
- A self join regardless of its join type
- After a left join, why can COUNT(*) differ from COUNT of a non-null right-side identifier?
- COUNT(*) counts only distinct customers
- COUNT of the identifier includes every null-extended row
- COUNT(*) automatically removes duplicate join keys
- COUNT(*) includes unmatched output rows while the identifier count excludes their nulls
- An AI explanation assumes ordinary equality will match two null join-key values. How should that claim be treated?
- Accept it because both sides contain the same missing-value marker
- Correct it using the database's null semantics
- Accept it because an outer join changes equality comparisons involving null
- Assume two null keys match whenever both source columns have the same data type