QuickBooks vs. TurboTax: Count Tax Filings by Product Line

Quick Overview

Write a SQL query that joins tax filings to a product table and counts the filings on two product lines, ignoring filing status and every other line. It tests joining a fact table to a lookup table, grouping at the right level, and counting filings instead of filers.

QuickBooks vs. TurboTax: Count Tax Filings by Product Line

Company: Intuit

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

Count the tax filings made with `'TurboTax'` products and with `'QuickBooks'` products. Filings on other product lines are excluded, and every filing counts regardless of its `filing_status`. Return `product_line` and `total_filings`, ordered alphabetically by `product_line`. ```hint Products and product lines One product line can contain several products. Check which column your grouping uses. ``` ### Input Table(s) `products` has primary key `product_id`. | Column | Type | Meaning | |---|---|---| | product_id | INT | Primary key | | product_name | VARCHAR(100) | Name of the specific product. NOT NULL | | product_line | VARCHAR(50) | The product line the product belongs to, such as `'TurboTax'` or `'QuickBooks'`. NOT NULL | `tax_filings` has primary key `filing_id`, and `product_id` references `products.product_id`. | Column | Type | Meaning | |---|---|---| | filing_id | INT | Primary key. One row per filing | | user_id | INT | The user who filed. NOT NULL | | product_id | INT | The product used for the filing. NOT NULL | | filing_date | DATE | The date of the filing. NOT NULL | | filing_status | VARCHAR(20) | The status of the filing. NOT NULL; it does not affect the count | ### Output Contract - Columns, in this order: `product_line`, `total_filings`. - At most two rows: one for `'TurboTax'` and one for `'QuickBooks'`. A line appears only when it has at least one filing. - `total_filings` is the number of `tax_filings` rows for that line. A user who files three times adds 3. - Order by `product_line` ascending. Each line appears once, so `'QuickBooks'` comes before `'TurboTax'` and the order is fully determined. ### Example Input table `products`: | product_id | product_name | product_line | |---|---|---| | 1 | TurboTax Deluxe | TurboTax | | 2 | TurboTax Premier | TurboTax | | 3 | QuickBooks Online | QuickBooks | | 4 | Budget Planner | Budgeting | Input table `tax_filings`: | filing_id | user_id | product_id | filing_date | filing_status | |---|---|---|---|---| | 101 | 1 | 1 | 2024-03-01 | accepted | | 102 | 2 | 2 | 2024-03-05 | rejected | | 103 | 1 | 2 | 2024-04-10 | pending | | 104 | 3 | 3 | 2024-01-31 | accepted | | 105 | 4 | 4 | 2024-02-15 | accepted | | 106 | 2 | 3 | 2024-04-15 | accepted | Expected output: | product_line | total_filings | |---|---| | QuickBooks | 2 | | TurboTax | 3 | Products 1 and 2 are both on the TurboTax line, so filings 101, 102 and 103 count toward TurboTax. Filing 102 is rejected and still counts, and user 1 filed twice on this line, which adds 2. Filings 104 and 106 use product 3 and count toward QuickBooks. Filing 105 is on the Budgeting line and is excluded. ### Constraints and Clarifications - `products` has at most 100 rows and `tax_filings` has at most 10,000 rows. - `product_line` values include `'TurboTax'`, `'QuickBooks'` and possibly other lines. Match the two values exactly as written. - Each `filing_id` is unique, and every `tax_filings.product_id` references a valid row in `products`. - No column in either table is NULL. - Every filing counts whatever its `filing_status`, including rejected and pending ones. - A product line with no filings does not appear in the output. There is no row with a count of 0.

Overview: Write a SQL query that joins tax filings to a product table and counts the filings on two product lines, ignoring filing status and every other line. It tests joining a fact table to a lookup table, grouping at the right level, and counting filings instead of filers.

Intuit logo
Intuit
Nov 25, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

Count the tax filings made with 'TurboTax' products and with 'QuickBooks' products. Filings on other product lines are excluded, and every filing counts regardless of its filing_status. Return product_line and total_filings, ordered alphabetically by product_line.

Input Table(s)

products has primary key product_id.

ColumnTypeMeaning
product_idINTPrimary key
product_nameVARCHAR(100)Name of the specific product. NOT NULL
product_lineVARCHAR(50)The product line the product belongs to, such as 'TurboTax' or 'QuickBooks'. NOT NULL

tax_filings has primary key filing_id, and product_id references products.product_id.

ColumnTypeMeaning
filing_idINTPrimary key. One row per filing
user_idINTThe user who filed. NOT NULL
product_idINTThe product used for the filing. NOT NULL
filing_dateDATEThe date of the filing. NOT NULL
filing_statusVARCHAR(20)The status of the filing. NOT NULL; it does not affect the count

Output Contract

  • Columns, in this order: product_line , total_filings .
  • At most two rows: one for 'TurboTax' and one for 'QuickBooks' . A line appears only when it has at least one filing.
  • total_filings is the number of tax_filings rows for that line. A user who files three times adds 3.
  • Order by product_line ascending. Each line appears once, so 'QuickBooks' comes before 'TurboTax' and the order is fully determined.

Example

Input table products:

product_idproduct_nameproduct_line
1TurboTax DeluxeTurboTax
2TurboTax PremierTurboTax
3QuickBooks OnlineQuickBooks
4Budget PlannerBudgeting

Input table tax_filings:

filing_iduser_idproduct_idfiling_datefiling_status
101112024-03-01accepted
102222024-03-05rejected
103122024-04-10pending
104332024-01-31accepted
105442024-02-15accepted
106232024-04-15accepted

Expected output:

product_linetotal_filings
QuickBooks2
TurboTax3

Products 1 and 2 are both on the TurboTax line, so filings 101, 102 and 103 count toward TurboTax. Filing 102 is rejected and still counts, and user 1 filed twice on this line, which adds 2. Filings 104 and 106 use product 3 and count toward QuickBooks. Filing 105 is on the Budgeting line and is excluded.

Constraints and Clarifications

  • products has at most 100 rows and tax_filings has at most 10,000 rows.
  • product_line values include 'TurboTax' , 'QuickBooks' and possibly other lines. Match the two values exactly as written.
  • Each filing_id is unique, and every tax_filings.product_id references a valid row in products .
  • No column in either table is NULL.
  • Every filing counts whatever its filing_status , including rejected and pending ones.
  • A product line with no filings does not appear in the output. There is no row with a count of 0.