Викторина, связанная с руководством · Средний Уровень
Как понять SQL-соединения с помощью теста AI
Попрактикуйтесь в результатах внутреннего и внешнего соединения, умножении строк «многие ко многим» и размещении фильтров на примерах небольших клиентов и заказов.
Вопрос 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