Timedora
Free Practice Quiz Question List

SQL Query Grain and Join Multiplicity Online Quiz Questions

Use this free practice quiz with 10 questions to review SQL Query Grain and Join Multiplicity, test your knowledge, and prepare for your next test or exam.

10 questions
01
Choose one
1 point

A query returns more rows than expected. Which is the best first approach to determine whether the extra rows come from valid matches, repeated source records, or an incorrect join?

  1. A

    Assume the source data is wrong and remove duplicate-looking rows.

  2. B

    Compare row counts around the joins, check key uniqueness and multiple matches, then identify what caused them.

  3. C

    Add DISTINCT to the query before investigating the joins.

  4. D

    Change every join to an inner join so fewer rows are returned.

02
Choose one
1 point

A sales query groups line-item revenue by order month and product category. What does each output row represent?

  1. A

    One row per order, because orders supply the date.

  2. B

    One row per product, because products supply the category.

  3. C

    One row per month-and-category combination.

  4. D

    One row per line item, because revenue is calculated from line items.

03
Choose one
1 point

An orders table has one row per order, and order_items has several rows per order. What can happen if a query joins these tables and then sums an order-level measure?

  1. A

    It repeats order-level attributes for matching items, so summing an order-level measure afterward can inflate the total.

  2. B

    It guarantees one output row per order because order ID is used as the join key.

  3. C

    It removes line-item detail and preserves only order-level values.

  4. D

    It prevents aggregation from changing the number of rows.

04
Choose one
1 point

Before writing SQL for a business question, which plan best clarifies what the query must produce?

  1. A

    Start with a SELECT statement, then decide which results seem useful.

  2. B

    Choose the tables first, join them all, and infer the output grain afterward.

  3. C

    Define only the measure; dates, scope, and output detail can be left implicit.

  4. D

    Define the measure, output grain, time basis, scope, and the source tables needed for those details.

05
Choose one
1 point

A query groups sales by month and product category, and its line-item records contain quantity and unit price. Which approach matches the measure to the grouping grain?

  1. A

    Sum an order-level total repeated on every line item, because the output is grouped by category.

  2. B

    Calculate revenue from line-item quantities and prices within each month-and-category group.

  3. C

    Sum all available numeric columns, since grouping defines the correct measure automatically.

  4. D

    Use the number of product categories as the revenue measure.

06
Choose one
1 point

A query joins raw order items and raw payments, and some orders have several of each. The resulting total is unexpectedly high. Which change most directly addresses the possible row multiplication?

  1. A

    Apply DISTINCT to the final result so repeated values disappear.

  2. B

    Join both raw tables on order ID and sum the payments after the join.

  3. C

    Aggregate payments to one row per order before joining them with the item-level data.

  4. D

    Remove all orders that have more than one payment.

07
Choose one
1 point

To report revenue by month and product category for completed orders, which source-table roles best support the query plan?

  1. A

    Use line items for quantities and prices, orders for dates and status, and products for category.

  2. B

    Use products for dates and order status, and orders for quantities and prices.

  3. C

    Use only the orders table, because it contains one row per order.

  4. D

    Use payment records for product categories and line-item prices.

08
Choose one
1 point

A report needs order-level payment totals alongside line-level sales, and an order may have multiple items and payments. Which approach best limits row multiplication?

  1. A

    Join raw payments and raw items, then use DISTINCT on all selected columns.

  2. B

    Remove the item table and infer sales from payment rows.

  3. C

    Aggregate items to one row per payment before joining.

  4. D

    Aggregate payments to one row per order, then join at the order level.

09
Choose one
1 point

A query intended to return one row per order produces several rows for some orders. What should you investigate first?

  1. A

    The source data is necessarily duplicated and should be deduplicated.

  2. B

    Check whether line-item or payment detail is included and whether the joins create multiple matches per order.

  3. C

    Change the intended output to one row per line item without further investigation.

  4. D

    Use DISTINCT, which guarantees that all order-level totals become correct.

10
Choose one
1 point

A query groups by order month and product category, sums line-item quantity multiplied by unit price, and filters for completed orders. Which statement best describes its output?

  1. A

    One row per order item, including orders of every status.

  2. B

    One row per product, with revenue calculated across all months.

  3. C

    One row per month-and-category combination, with revenue across line items for completed orders.

  4. D

    One row per month, with no category distinction.