logo

8 Huntington Bank SQL Interview Questions (Updated 2024)

Updated on

June 30, 2024

Huntington Bank employees write SQL queries often for analyzing banking transaction data for fraud detection, and managing customer data for personalized marketing strategies. For this reason Huntington Bank often tests SQL questions during interviews for Data Science and Data Engineering positions.

Thus, to help you ace the Huntington Bank SQL interview, we've collected 8 Huntington Bancshares SQL interview questions in this article.

Huntington Bank SQL Interview Questions

8 Huntington Bancshares SQL Interview Questions

SQL Question 1: Analyzing Loan Payments

As a data analyst at Huntington Bank, you are tasked with analyzing the loan payment behavior of customers. In particular, the bank wants to know the total amount paid by each customer each month and the ranking of customers monthly, based on the total amount paid. A ranking of 1 means the customer paid the most compared to other customers in a particular month.

We have the following data in the table:

Example Input:
payment_idcustomer_idpayment_dateamount_paid
10012022-07-01500.00
20022022-07-05450.00
30012022-07-15500.00
40032022-07-10700.00
50022022-08-05450.00
60032022-08-10700.00
70012022-08-01500.00
80012022-08-15500.00

Question:

Write a SQL query that provides the total amount paid by each customer each month and their ranking based the total amount paid. The output should be sorted by the year and month in ascending order and the ranking in descending order.

Example Output:
YearMonthCustomer IDTotal Amount PaidRanking
20227003700.001
202270011000.002
20227002450.003
202280011000.001
20228003700.002
20228002450.003

Answer:


In the SQL query above, we used an aggregate function SUM() to calculate the total amount paid by each customer each month. We also used the window function RANK() to rank the customers based on the total amount paid. The PARTITION BY clause in the window function allows us to calculate the ranking separately for each month. Finally, we grouped the results by year, month, and customer_id and ordered the output by year, month, and ranking in descending order.

For more window function practice, try this Uber SQL Interview Question within DataLemur's online SQL code editor:

Uber Window Function SQL Interview Question

SQL Question 2: Employees Earning More Than Their Boss

Given a table of Huntington Bank employee salary information, write a SQL query to find all employees who make more than their direct boss.

Huntington Bank Example Input:

employee_idnamesalarydepartment_idmanager_id
1Emma Thompson38001
2Daniel Rodriguez2230110
3Olivia Smith800018
4Noah Johnson680028
5Sophia Martinez1750110
8William Davis70002NULL
10James Anderson40001NULL

Example Output:

employee_idemployee_name
3Olivia Smith

This is the output because Olivia Smith earns $8,000, surpassing her manager, William Davis who earns 7,800.

Test your SQL query for this question and run your code right in DataLemur's online SQL environment:

Employees Earning More Than Their Manager

Answer:

First, we perform a SELF-JOIN where we treat the first table () as the managers' table and the second table () as the employees' table. Then we use a clause to filter the results, ensuring we only get employees whose salaries are higher than their manager's salary.


If the solution above is confusing, you can find a step-by-step solution here: Employees Earning More Than Managers.

SQL Question 3: What are the ACID properties in a DBMS?

A transaction is a one or more SQL commands which are executed as a singular unit if the transaction -commits- (or no execution hapens if the transaction -aborts-).

For transactions, a DBMS is supposed to enforce the follwing ACID properties: Atomicity, Consistency, Isolation, & Durability.

Here's what each one means:

  • Atomicity: the transaction is completed in an all-or-nothing way (no partial commits)
  • Consistency: the transaction is valid and follows all constraints and restrictions
  • Isolation: the transaction doesn't affect another transaction
  • Durability: the committed transactions is stored permanently in the DB (it doesn't dissapear!)

As you can see, it's pretty important for the multiple databases where Huntington Bank store's it's data to be ACID-compliant!

Huntington Bancshares SQL Interview Questions

SQL Question 4: Average Account Balance Query for Huntington Bank

As a data scientist for Huntington Bank, they might want you to calculate the average account balance for each account type over the span of a month. The bank offers three main types of accounts: Checking, Savings, and Certificate of Deposit (CD).

Example Input:

account_iduser_idaccount_typeopening_dateclosing_date
101123Checking01/13/2022-
102265Savings01/15/2022-
103362Checking01/20/2022-
104192CD02/02/2022-
105981Savings02/05/2022-

Example Input:

account_iddatebalance
10101/30/20221200.00
10102/28/20221500.20
10201/30/20225500.00
10202/28/20225600.30
10301/30/20222200.00
10302/28/20222350.40
10401/30/2022-
10402/28/20225500.00
10501/30/2022-
10502/28/202210400.20

Your task is to write an SQL query which estimates the average balance for each type of account for the months of January and February.

Answer:


Example Output:

account_typemonthavg_balance
Checking01/01/20221700.00
Checking02/01/20221925.30
Savings01/01/20225500.00
Savings02/01/20228000.25
CD01/01/2022-
CD02/01/20225500.00

This query first joins the table and table on . It then averages the column, grouping by both and , after truncating the column to the precision of month. The average calculation excludes any NULL balances, so it properly handles accounts that were not opened in the month of January.

To practice a very similar question try this interactive Amazon Average Review Ratings Question which is similar for calculating averages for categories or this JPMorgan Chase Card Launch Success Question which is similar for aggregating data over a month.

Check out the Huntington Bank career page and see what type of role is the best fit for your experience.

SQL Question 5: Why would it make sense to denormalize a database?

Denormalization is the practice of altering a database schema in a way that breaks the normalization rules (1st, 2nd, 3rd normal forms).

For example, in a database that stores Huntington Bank sales analytics data, you might have separate tables for "customers," "orders," and "products," with foreign key constraints linking the tables together. This helps to ensure the integrity of the data and reduces redundancy, but it can also make queries that involve multiple tables more complex and slower to execute.

By de-normalizing the database, you can combine some of the data from separate tables into a single table, which can reduce the number of joins that are required to retrieve the data you need. This can speed up queries and improve the performance of your database.

However, it's important to carefully consider the trade-offs of de-normalization before making any changes to your database. De-normalization can make it more difficult to maintain the integrity and reliability of your data, and can also increase the risk of data redundancy. It's generally best to use de-normalization as a performance optimization technique only when necessary, and to carefully evaluate the benefits and drawbacks in the context of your specific database and workload.

SQL Question 6: Calculate the Sum of Loan Amounts by Loan Type

Assume we have a table where each row represents a loan granted by Huntington Bank. The loan type could be "Personal", "Mortgage", "Car", etc. Write a SQL query to find the sum of loan amounts by loan type.

Example Input:

loan_idcustomer_idloan_typeloan_amountloan_date
1001501"Personal"1000001/01/2022
1002502"Mortgage"20000001/02/2022
1003503"Car"1500001/03/2022
1004504"Personal"1500001/04/2022
1005505"Mortgage"25000001/05/2022

Example Output:

loan_typetotal_loan_amount
"Personal"25000
"Mortgage"450000
"Car"15000

Answer:


This SQL query uses the clause to group the loans by their type. Then, for each group, it calculates the sum of the loan amounts using the function. The resulting table contains each loan type and the corresponding total loan amount given out by Huntington Bank for that type.

SQL Question 7: Can you explain what a cross-join is and the purpose of using them?

A cross-join, also known as a cartesian join, is a type of JOIN operation in SQL that creates a new table by combining each row from the first table with every row from the second table. This results in a table with a row for every possible combination of rows from the two input tables.

An example of when this might be useful is if you wanted to first make a dataset containing all possible pairs of customers and products data, in order to later build a Machine Learning model to predict the probability of a customer purchasing a particular product.


However, it is important to note that cross-joins can create very large tables, especially if the input tables have a large number of rows. For example, if you had 10,000 customers and 5,000 different product SKUs, the resulting cross-join would have 50 million rows.

SQL Question 8: Calculate Average Balance with Math Functions

Huntington Bank has a table that records the balance of customers for the past year. Given this data, the bank wants to find the average absolute monthly balance per customer, rounded to the nearest dollar.

The monthly balance should be aggregated by the absolute difference between the maximum and minimum balance within a month.

The contains the following columns:

  • : The unique ID of the bank customer
  • : The date of the available balance
  • : The balance amount on a given day
Example Input:
customer_idbalance_datebalance
100103/01/20225000
100103/15/2022-5000
100203/10/20227000
100203/20/202210000
100203/31/20228000
100104/02/20224000
100104/19/20223500
100204/05/20229000
100204/28/20227000
Example Output:
customer_idmonthavg_abs_balance
100135000
100144000
100233000
100242000

Answer:


This query first calculates the maximum and minimum balance for each customer per month in the subquery. The difference between these max and min balances are then averaged and rounded to the nearest dollar in the main query.

The two most similar questions to the one given are "Cards Issued Difference" and "Compressed Mean". They both involve similar SQL operations - the calculation of differences between maximum and minimum values and the calculation of averages.

Here is the markdown:

To practice a very similar question try this interactive JPMorgan Chase Cards Issued Difference Question which is similar for calculating the difference between maximum and minimum balances or this Alibaba Compressed Mean Question which is similar for calculating average balances.

Huntington Bank SQL Interview Tips

The key to acing a Huntington Bank SQL interview is to practice, practice, and then practice some more! Besides solving the above Huntington Bank SQL interview questions, you should also solve the 200+ DataLemur interview questions which come from companies like Facebook, Google and unicorn tech startups. DataLemur Questions

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

To prep for the Huntington Bank SQL interview you can also be useful to solve interview questions from other banking & finanacial services companies like:

But if your SQL coding skills are weak, don't worry about diving straight into solving questions – improve your SQL foundations with this free SQL for Data Analytics course.

SQL tutorial for Data Scientists & Analysts

This tutorial covers topics including joining a table to itself and functions like SUM()/COUNT()/AVG() – both of these pop up routinely in Huntington Bank SQL interviews.

Huntington Bancshares Data Science Interview Tips

What Do Huntington Bank Data Science Interviews Cover?

Beyond writing SQL queries, the other question categories tested in the Huntington Bank Data Science Interview include:

Huntington Bank Data Scientist

How To Prepare for Huntington Bank Data Science Interviews?

To prepare for Huntington Bank Data Science interviews read the book Ace the Data Science Interview because it's got:

  • 201 interview questions sourced from Facebook, Google & startups
  • a refresher on Python, SQL & ML
  • over 1000+ reviews on Amazon & 4.5-star rating

Ace the Data Science Interview by Nick Singh Kevin Huo