10 New Relic SQL Interview Questions (Updated 2024)

Updated on

March 2, 2024

At New Relic, SQL is used often for analyzing application performance data to and to find trends in data collected from cloud-based observability tools. That's why New Relic often tests SQL query questions during interviews for Data Analytics, Data Science, and Data Engineering jobs.

So, to help you ace the New Relic SQL interview, this blog covers 10 New Relic SQL interview questions – able to answer them all?

10 New Relic SQL Interview Questions

SQL Question 1: Identify the Whale Users for New Relic

New Relic is an American software analytics company that specializes in monitoring and performance management products for business applications. The company provides a SaaS monitoring platform that collects, stores, and parses web application performance metrics.

Given the nature of New Relic’s services, a 'Whale User' can be defined by, for instance, the frequency and volume of data transmission events, since whale users are likely to generate a lot of data on the platform.

Assume we have the table containing historical data of each transmission event. The challenge here is to write a SQL query that identifies the top 5 users who send the most volume of data over the last month.

Our example tables look like this:

Example Input:

To aim at the top 5 whale users, we need to aggregate the volume of data sent by each user over the past month and order the users by their total data volume in descending order.


This query calculates the sum of for each user () for events that happened in the last month. The results are sorted in descending order by the total data volume and the clause restricts the output to the top 5 users. This gives us the top 5 'Whale Users' for New Relic in the past month.

To practice a similar power-user data analysis problem question on DataLemur's free interactive SQL code editor, try this recently asked Microsoft SQL interview question: Microsoft SQL Interview Question: Teams Super User

SQL Question 2: Calculate Average User Session Length

New Relic is a software analytics company, so let's imagine a situation where you're given a dataset logging all user sessions in a certain period, and you're asked to calculate the average session length.

Here is your input data set:

Example Input:
110103/01/2022 09:30:0003/01/2022 10:00:00
210203/01/2022 11:15:0003/01/2022 11:45:00
310103/01/2022 15:30:0003/01/2022 16:00:00
410304/01/2022 09:10:0004/01/2022 09:30:00
510204/01/2022 13:45:0004/01/2022 14:15:00

Each row represents one session for a user, defined by a start time and end time.

The question you should answer is: what is the average session length for each user, in minutes?

Here is the required output:

Example Output:


Here is a SQL query you could write in PostgreSQL to get this result:

This query works by subtracting the from the for every row in the table resulting in an interval, it then extracts this interval as epochs (in seconds), and divides by 60 to convert to minutes. After obtaining the session lengths in minutes, it calculates the average session length for each user by grouping by and averaging the session lengths.

To solve a similar window function question on DataLemur's free online SQL coding environment, try this Google SQL Interview Question: Google SQL Interview Question

SQL Question 3: What's the difference between a left and right join?

In SQL, both a left and right join is used to combine rows from different tables based on a shared key or set of keys, resulting in a single merged table of data. However, here's the difference:

LEFT (OUTER) JOIN: Retrieves all the records/rows from the left and the matched records/rows from the right table.

RIGHT (OUTER) JOIN: Retrieves all the records/rows from the right and the matched records/rows from the left table.

New Relic SQL Interview Questions

SQL Question 4: Calculate the Average Server Response Time

As a data analyst at New Relic, your role would involve providing insights into software application performance data. One essential metric is the server response time, which could be crucial in identifying and addressing performance issues.

Your task is to find out the average server response time for each application on a daily basis.

Example Input:
Example Output:


This SQL query groups the data by date and application ID to calculate the daily average server response time for each application. The AVG function is used to compute the average server response time in milliseconds.

To practice a very similar question try this interactive Amazon Server Utilization Time Question which is similar for calculating total utilization time or this Facebook Average Post Hiatus (Part 1) Question which is similar for daily calculations over data.

SQL Question 5: What are the different types of database indexes?

An index in a database is a data structure that helps to quickly find and access specific records in a table.

For example, if you had a database of New Relic customers, you could create a primary index on the column.

Having a primary index on the column can speed up performance in several ways. For example, if you want to retrieve a specific customer record based on their , the database can use the primary index to quickly locate and retrieve the desired record. The primary index acts like a map, allowing the database to quickly find the location of the desired record without having to search through the entire table.

Additionally, a primary index can also be used to enforce the uniqueness of the column, ensuring that no duplicate values are inserted into the table. This can help to prevent errors and maintain the integrity of the data in the table.

SQL Question 6: Analyzing Click-Through Rates

New Relic, a digital intelligence company, wants to measure the click-through rate from their product page to the page where the customer adds the product to their cart. They are interested in two aspects:

  1. Which product had the most successful click-through rates in the last month?
  2. Overall, what is the percentage of visits to the product page that resulted in the product being added to the cart?

To help analyze this, you have two tables:

One table "page_visits"

701281208/01/2022 00:00:0071001
803260108/03/2022 00:00:0031512
546240008/05/2022 00:00:0071001
710014208/06/2022 00:00:0031512
487091208/10/2022 00:00:0071001

Another table "cart_adds"

215481208/01/2022 00:01:0071001
205360108/03/2022 00:02:0031512
234140008/05/2022 00:03:0071001


First, let's answer what is the total click-through-rate for all products.

Next, let's answer which product had the most successful click-through-rate.

The first part of this block computes the total click-through rate. The second part computes the click-through rate per product, and returns the product with the highest click-through rate. It does so by joining the two tables on the user_id and product_id and counting the number of adds and visits for each product, then dividing the number of adds by the number of visits for the click-through rate.

To solve another question about calculating rates, solve this TikTok SQL Interview Question on DataLemur's interactive coding environment: Signup Activation Rate SQL Question

SQL Question 7: What does do?

The SQL command merges the results of multiple statements and keeps only those rows that are present in all sets.

For example, say you were doing an HR Analytics project for New Relic, and had access to New Relic's employees and contractors data. Assume that some employees were previously contractors, and vice versa, and thus would show up in both tables. You could use operator to find all contractors who also show up in the employees table:

SQL Question 8: Calculate the Average Response Time for Each Application

New Relic is a software analytics company that offers cloud-based software to help website and application owners track the performance of their services.

For this exercise, we have a table named that tracks the response times per application on a daily basis. The goal is to write an SQL query that finds the average response time for each application for the past 30 days.

Example Input:

The result should be a table that includes each unique and its average over the last 30 days.

Example Output:


This query first filters the data for the last 30 days. It then groups the data by and calculates the average for each group. The result is a list of applications with their average response times.

SQL Question 9: Filtering Customer Records from New Relic

At New Relic, we have a Customer Records database where each row represents a unique customer's interaction with our business. A typical row in this table includes columns for customer_id, customer_name, interaction_date, and resource_used (the specific resource/service the customer used).

Find all customers who interacted with our 'APM' (Application Performance Monitoring) resource during the month of June 2022. The resource_used column should contain the string 'APM' and the interaction_date should fall in June 2022.

Example Input:
1034Alice Marlow06/05/2022 00:00:00APM
5786John Smith05/15/2022 00:00:00APM
6784Rachel Green06/18/2022 00:00:00Browser
2454Monica Geller07/04/2022 00:00:00APM
3890Danny Wong06/09/2022 00:00:00APM
Example Output:
1034Alice Marlow
3890Danny Wong


This query uses the keyword to filter rows in the table where the is 'APM'. It then uses the function to extract the month and year from the and ensure that the interaction happened in June 2022.

SQL Question 10: How do you select records without duplicates from a table?

The clause in SQL allows you to select records that are unique, eliminating duplicates.

For example, if you had a table of New Relic employees, and wanted to see what are all the unique job titles that currently worked at the company, you could write the following query:

New Relic SQL Interview Tips

Assuming that you've already got basic SQL skills, the next best tip we have to prepare for the New Relic SQL interview is to solve as many practice SQL interview questions as you can! Beyond just solving the above New Relic SQL interview questions, you should also solve the 200+ SQL Interview Questions on DataLemur which come from companies like FAANG and tech startups. DataLemur Questions

Each exercise has multiple hints, step-by-step solutions and crucially, there's an online SQL coding environment so you can easily right in the browser your SQL query answer and have it graded.

To prep for the New Relic SQL interview you can also be useful to solve SQL questions from other tech companies like:

But if your SQL skills are weak, don't worry about jumping right into solving questions – refresh your SQL knowledge with this interactive SQL tutorial.

SQL tutorial for Data Scientists & Analysts

This tutorial covers SQL concepts such as creating summary stats with GROUP BY and aggregate functions like SUM()/COUNT()/AVG() – both of which pop up often during New Relic SQL assessments.

New Relic Data Science Interview Tips

What Do New Relic Data Science Interviews Cover?

Besides SQL interview questions, the other topics to practice for the New Relic Data Science Interview are:

New Relic Data Scientist

How To Prepare for New Relic Data Science Interviews?

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

  • 201 interview questions sourced from Microsoft, Amazon & startups
  • a refresher covering Stats, SQL & ML
  • over 900+ reviews on Amazon & 4.5-star rating

Ace the DS Interview