Back to questions

Consecutive Filing Years Intuit SQL Interview Question

Consecutive Filing Years

Intuit SQL Interview Question

Intuit, a company known for its tax filing products like TurboTax and QuickBooks, offers multiple versions of these products.

Write a query that identifies the user IDs of individuals who have filed their taxes using any version of TurboTax for three or more consecutive years. Each user is allowed to file taxes once a year using a specific product. Display the output in the ascending order of user IDs.

Table:

Column NameType
filing_idinteger
user_idvarchar
filing_datedatetime
productvarchar

Example Input:

filing_iduser_idfiling_dateproduct
114/14/2019TurboTax Desktop 2019
214/15/2020TurboTax Deluxe
314/15/2021TurboTax Online
424/07/2020TurboTax Online
524/10/2021TurboTax Online
634/07/2020TurboTax Online
734/15/2021TurboTax Online
833/11/2022QuickBooks Desktop Pro
944/15/2022QuickBooks Online

Example Output:

user_id
1

Explanation:

User 1 has consistently filed their taxes using TurboTax for 3 consecutive years. User 2 is excluded from the results because they missed filing in the third year and User 3 transitioned to using QuickBooks in their third year.

The dataset you are querying against may have different input & output - this is just an example!

Input

Output