QuickBooks vs TurboTax
Intuit offers several tax filing products, such as TurboTax and QuickBooks, which come in multiple versions.
Write a query to find the total number of filings that used TurboTax, and the total number of filings that used QuickBooks.
|1||1||4/14/2019||TurboTax Desktop 2019|
|8||3||3/11/2022||QuickBooks Desktop Pro|
There were 7 filings using TurboTax and 2 filings using QuickBooks.
If you like this question, try out a similar question, Laptop vs Mobile Viewers!
Let's start with the TurboTax products and apply the same logic for QuickBooks products as we go along.
If you look at the TurboTax data in the table, you'll see that there are differently named products under the TurboTax line. However, a pattern is evident as all the records begin with the word TurboTax.
Using the percent sign () wildcard, the operator compares a value to other values that are similar to it. The percent () sign can be used to signify 0, 1, or many characters.
As we are looking for all the TurboTax products and we know that the subsequent characters after 'TurboTax' represents the differently named versions of the TurboTax products, we will then append to the end of the expression Turbotax to obtain all the TurboTax products.
Note that we are only showing the query for TurboTax products. You'll have to do the same for QuickBooks products.
The output of the 1st 3 rows:
|1||TurboTax Desktop 2019|
Per the expected output format, the numbers for TurboTax and QuickBooks must be displayed in separate columns.
This is how you can implement it in a query:
The result from the above query is for 3 only:
|8||QuickBooks Desktop Pro||0||1|
Solution #1: Using CASE Statement
Output for 3:
Below, we show another solution using the keyword.
Solution #2: Using FILTER