8 H&R Block SQL Interview Questions (Updated 2024)

Updated on

June 30, 2024

H&R Block employees write SQL queries daily for analyzing tax-related data and optimizing client financial data queries. That's why H&R Block often tests SQL questions during interviews for Data Analytics, Data Science, and Data Engineering jobs.

To help you prep for the H&R Block SQL interview, here’s 8 H&R Block SQL interview questions in this blog.

H&R Block SQL Interview Questions

8 H&R Block SQL Interview Questions

SQL Question 1: Identify Power Users for H&R Block

H&R Block is a company that offers tax preparation services. One important metric for them could be the number of tax returns a customer files in a given year using their service, presumably, customers filing more tax returns are more valuable to the business.

Please write a SQL query to find all customers who have filed more than 10 tax returns within the year 2022. The output should include the user ID, user full name, and the total number of tax returns they filed within 2022.

Sample Input:
Sample Input:


The SQL query will look like this:


This query joins the table with the table on the field, then it filters out the tax returns that were not filed in the year 2022. It groups the results by user and counts the number of tax returns each user has filed. Finally, it filters out the users who have filed 10 or fewer tax returns.

To practice a similar customer analytics SQL question where you can solve it right in the browser and have your SQL solution instantly graded, try this Walmart SQL Interview Question: Walmart SQL Interview Question

Read more about HR&R Block's Data Security, since it's a project that their data analysts/scientists work on!

SQL Question 2: Top Three Salaries

Imagine there was a table of H&R Block employee salary data. Write a SQL query to find the top 3 highest earning employees in each department.

H&R Block Example Input:

1Emma Thompson38001
2Daniel Rodriguez22301
3Olivia Smith20001
4Noah Johnson68002
5Sophia Martinez17501
8William Davis68002
10James Anderson40001

Example Input:

1Data Analytics
2Data Science

Example Output:

Data AnalyticsJames Anderson4000
Data AnalyticsEmma Thompson3800
Data AnalyticsDaniel Rodriguez2230
Data ScienceNoah Johnson6800
Data ScienceWilliam Davis6800

Check your SQL query for this question directly within the browser on DataLemur:

Top 3 Department Salaries


We use the DENSE_RANK() window function to generate unique ranks for each employee's salary within their department, with higher salaries receiving lower ranks. Then, we wrap this up in a CTE and filter the employees with a ranking of 3 or lower.

If the solution above is confusing, you can find a step-by-step solution here: Top 3 Department Salaries.

SQL Question 3: What's the main difference between ‘BETWEEN’ and ‘IN’ operators?

is used to select rows that match a range of values, whereas the operator checks for values in a specified list of values.

For example, say you were a Data Analyst at H&R Block and had a table of advertising campaign data.

To find campaigns with between 500and500 and 10k in spend, you could use BETWEEN`:

To find ad campaigns that were run on Facebook and Google's Display Network, you could use :

H&R Block SQL Interview Questions

SQL Question 4: Compute Average Service Rating per Tax Professional by Month

As an analyst for H&R Block, your task is to compute the average service rating received by each Tax Professional on a month-by-month basis over the past year. This data will be used to gauge employee performance and client satisfaction over time.

Example Input:
100135707/01/2022 00:00:005
200256207/10/2022 00:00:004
300198107/11/2022 00:00:003
400378308/18/2022 00:00:004
500246209/05/2022 00:00:005
Example Output:


This query uses a window function to compute the average rating per Tax Professional per month over the past year. The window function works by creating a 'window' of rows around each current row based upon the PARTITION criteria; in this case, , , and . It then computes the average rating over this set of rows. The result is an average rating for each Tax Professional for each month. Finally, the records are ordered by year, month, and then .

To solve another window function question on DataLemur's free interactive coding environment, solve this Google SQL Interview Question: Google SQL Interview Question

SQL Question 5: Can you explain the purpose of UNION?

The operator merges the output of two or more statements into a single result set. The two SELECT statements within the UNION must have the same number of columns and the data types of the columns are all compatible.

For example, if you were a Data Analyst on the marketing analytics team at H&R Block, this statement would return a combined result set of both H&R Block's Google and Facebook ads that have more than 300 impressions:

SQL Question 6: Database Design for H&R Block's Client Tax Returns

H&R Block, a tax preparation service, needs a database to track all tax returns processed by various clients. Assume the following:

  1. A client can have multiple tax returns.
  2. Each tax return contains various forms with their respective data.
  3. Different clients may process tax returns in different states.
  4. Certain forms or data might only be relevant for returns in specific states.

Design a database schema that enables H&R Block to store, retrieve and analyze data efficiently. Also, write a SQL query to find out the total number of clients who have processed their tax returns in a specific state last year.

Sample Table:
123John Smith
427Alice Johnson
789Robert Brown
Sample Table:
Sample Table:


This query returns the total number of distinct clients who processed their tax returns in California during the year 2021. The keyword is necessary to ensure that each client is counted only once, even if they processed multiple tax returns.

SQL Question 7: What do primary keys do?

The primary key of a table is a column or set of columns that serves as a unique identifier for each row. It ensures that all rows are distinct and does not allow null values.

For example, say you had stored some Facebook ad campaign data that H&R Block ran:

The CampaignID column is used to uniquely identify each row in the table, and the constraint ensures that there are no duplicate CampaignID values. This helps to maintain the accuracy of the data by preventing duplicate rows. The primary key is also an important part of the table because it enables you to easily identify and reference specific campaigns in your Facebook Ad data. You can use it to join to other tables in the database, such as a table with data on the results of the campaigns.

SQL Question 8: Filter HR Block Customers Based on Income and Transaction History

H&R Block, a tax preparation company, is launching a new premium service for high-income earners who have used their services in the past two years. To identify potential customers, they would like you to write a query to filter their database for customers who have an annual income greater than $100,000, and have had at least two transactions in the past two years.

The two relevant tables are and . The table has a record for each customer, while the table keeps track of each transaction a customer has.

Sample Data:



This query first finds the customers who have at least two transactions in the past two years by grouping transactions by the and filtering groups with at least two transactions. It then joins this list of customer IDs with the customers who earn over $100,000 annually. The result is a list of and for high earning customers who have at least two transactions in the past two years.

How To Prepare for the H&R Block SQL Interview

Assuming that you've already got basic SQL skills, the next best tip we have to prepare for the H&R Block SQL interview is to solve as many practice SQL interview questions as you can! Beyond just solving the earlier H&R Block SQL interview questions, you should also solve the 200+ SQL coding questions which come from companies like FAANG (FB, Apple, Amazon, Netflix, Google). DataLemur Question Bank

Each problem on DataLemur has hints to guide you, detailed solutions and best of all, there's an online SQL coding environment so you can instantly run your SQL query and have it executed.

To prep for the H&R Block SQL interview it is also wise to practice SQL questions from other payment & credit companies like:

However, if your SQL query skills are weak, don't worry about jumping right into solving questions – improve your SQL foundations with this interactive SQL tutorial.

DataLemur SQL Course

This tutorial covers topics including handling strings and LEFT vs. RIGHT JOIN – both of which show up frequently during SQL interviews at H&R Block.

H&R Block Data Science Interview Tips

What Do H&R Block Data Science Interviews Cover?

Besides SQL interview questions, the other question categories to practice for the H&R Block Data Science Interview are:

H&R Block Data Scientist

How To Prepare for H&R Block Data Science Interviews?

To prepare for H&R Block Data Science interviews read the book Ace the Data Science Interview because it's got:

  • 201 interview questions sourced from Google, Microsoft & tech startups
  • a crash course on SQL, AB Testing & ML
  • over 1000+ 5-star reviews on Amazon

Ace the DS Interview