At Nike, SQL is to predict trends, and manage inventory databases for accurate stocks and distribution planning. So, it shouldn't surprise you that Nike asks SQL query questions during interviews for Data Analytics, Data Science, and Data Engineering jobs.
Thus, to help you prepare, we've curated 8 Nike SQL interview questions – how many can you solve?
For Nike's auditing purposes, they want to analyze their monthly performance. Write a SQL query to find the average sales amount (in USD) per product on a monthly basis using data from the last year. Assume that each product ID corresponds to a single type of product sold by Nike.
Here are your sample tables:
sales_id | product_id | sales_date | amount |
---|---|---|---|
1001 | 100 | 01/12/2021 | $200 |
1002 | 200 | 01/18/2021 | $150 |
1003 | 300 | 02/23/2021 | $120 |
1004 | 100 | 02/05/2021 | $180 |
1005 | 200 | 05/31/2021 | $160 |
1006 | 300 | 06/17/2021 | $240 |
1007 | 100 | 07/22/2021 | $210 |
1008 | 200 | 10/03/2021 | $130 |
1009 | 300 | 12/13/2021 | $220 |
1010 | 100 | 12/22/2021 | $200 |
month | product_id | avg_amount |
---|---|---|
01 | 100 | $200 |
01 | 200 | $150 |
02 | 100 | $180 |
02 | 300 | $120 |
05 | 200 | $160 |
06 | 300 | $240 |
07 | 100 | $210 |
10 | 200 | $130 |
12 | 100 | $200 |
12 | 300 | $220 |
This query takes sales from 2021, and then groups them by month and product_id. The average amount of each product sold in each month is calculated with the AVG function. The result is ordered by month and product_id.
To solve a similar window function question on DataLemur's free interactive SQL code editor, solve this Google SQL Interview Question:
Suppose you had a table of Nike employee salaries, along with which department they belonged to. Write a query to compare the average salary of employees in each department to the company's average salary for March 2024. Return the comparison result as 'higher', 'lower', or 'same' for each department. Display the department ID, payment month (in MM-YYYY format), and the comparison.
Code your solution to this interview question and run your code right in DataLemur's online SQL environment:
The solution is LONG – 30+ lines of SQL. You can find a detailed solution here: Department Salaries.
The keyword removes duplicates from a query.
Suppose you had a table of Nike customers, and wanted to figure out which cities the customers lived in, but didn't want duplicate results.
table:
name | city |
---|---|
Akash | SF |
Brittany | NYC |
Carlos | NYC |
Diego | Seattle |
Eva | SF |
Faye | Seattle |
You could write a query like this to filter out the repeated cities:
Your result would be:
city |
---|
SF |
NYC |
Seattle |
As a Data analyst at Nike, you are tasked with understanding the footwear market to provide insightful reports for the product team. They want to understand the average shoe size sold in different months.
Using the table, write a SQL query to calculate the average shoe size sold per month.
sales_id | customer_id | sale_date | shoe_id | shoe_size |
---|---|---|---|---|
1001 | 2001 | 06/02/2022 00:00:00 | 30001 | 9 |
1002 | 2002 | 06/13/2022 00:00:00 | 30002 | 10 |
1003 | 2003 | 06/29/2022 00:00:00 | 30003 | 8 |
1004 | 2004 | 07/14/2022 00:00:00 | 30004 | 11 |
1005 | 2005 | 07/20/2022 00:00:00 | 30005 | 9 |
month | average_shoe_size |
---|---|
6 | 9.00 |
7 | 10.00 |
This SQL query extracts the month from the column and groups the data based on these months. The average shoe size sold in every month is then calculated with the function.
To practice a very similar question try this interactive Amazon Highest-Grossing Items Question which is similar for requiring data aggregation to find product statistics or this Amazon Average Review Ratings Question which is similar for needing monthly data averages.
A DBMS (database management system), in order to ensure transactions are relaible and don't ruin the integrity of the data, tries to mantain the following ACID properties: Atomicity, Consistency, Isolation, and Durability.
To make this concept more concrete, here is what each of the ACID properties would mean in the context of banking transactions:
Nike, a multinational corporation that is engaged in the design, development, manufacturing, and worldwide marketing and sales of footwear, apparel, equipment, and accessories, wants to better understand their sales for each type of product they sell.
Your task is to write a SQL query that can calculate the average price of each product type that has been sold.
sale_id | product_id | product_type | sale_price |
---|---|---|---|
1001 | A001 | Shoes | 120 |
1002 | B001 | Apparel | 70 |
1003 | A002 | Shoes | 150 |
1004 | C001 | Accessories | 30 |
1005 | B002 | Apparel | 90 |
1006 | A003 | Shoes | 130 |
product_type | avg_price |
---|---|
Shoes | 133.33 |
Apparel | 80 |
Accessories | 30 |
In this PostgreSQL query, we are selecting the and the average (calculated using AVG function) from the table. We group the result by to receive the average price for each unique product type. is an aggregate function that returns the average value of a numeric column.
{#Question-7}
The UNION operator combines the results from multiple SELECT statements into a single result set.
Here's an example of using the UNION operator to combine the results of two SELECT statements that retrieve data from tables of Nike's Facebook ads and their Google ads:
This statement would return a combined result set of both Facebook and Google ads that have a spend greater than $200. The result set would include the following columns: ad_id, ad_name, ad_type, impressions, clicks, and spend.
Note that the two SELECT statements within the UNION must have the same number of columns and the columns must have similar data types. In this example, both SELECT statements have the same number of columns and the data types of the columns are all compatible.
Assume that Nike wants to conduct an analysis on their yearly and seasonal sales. They want to identify the total sales volume, the average discount offered, and the rounded figure of average discount per footwear type each year and season. The seasons are categorized as follows: Winter (December, January, February), Spring (March, April, May), Summer (June, July, August), Fall (September, October, November).
sale_id | sale_date | footwear_type | price | discount |
---|---|---|---|---|
2355 | 2022-01-15 | Running Shoes | 85 | 5 |
3612 | 2022-03-10 | Basketball Shoes | 120 | 10 |
1755 | 2022-06-20 | Running Shoes | 90 | 7 |
6792 | 2022-09-12 | Training Shoes | 105 | 8 |
4815 | 2022-05-04 | Basketball Shoes | 115 | 9 |
The above SQL query first calculates total sales and average discount per year and season in common table expression (CTE). Then it queries from this CTE to get results with rounded average discounts. The clause is used to isolate the seasons, and is used to extract year and month from . The clause is used to partition the data into each unique combination of year, season and footwear type. The and functions are used to get sales volume and average discount, respectively. Then rounding off the average discount is done using function.
To practice a very similar question try this interactive Wayfair Y-on-Y Growth Rate Question which is similar for calculating yearly sales data or this Amazon Highest-Grossing Items Question which is similar for identifying top performing products.
The key to acing a Nike SQL interview is to practice, practice, and then practice some more! Beyond just solving the earlier Nike SQL interview questions, you should also solve the 200+ SQL Interview Questions on DataLemur which come from companies like Microsoft, Google, and Facebook.
Each problem on DataLemur has multiple hints, full answers and best of all, there's an interactive coding environment so you can instantly run your SQL query and have it checked.
To prep for the Nike SQL interview it is also useful to practice interview questions from other apparel companies like:
However, if your SQL coding skills are weak, don't worry about going right into solving questions – go learn SQL with this DataLemur SQL Tutorial.
This tutorial covers SQL concepts such as LEAD/LAG and math functions in SQL – both of these pop up frequently in Nike SQL assessments.
Beyond writing SQL queries, the other types of problems tested in the Nike Data Science Interview are:
I'm sorta biased, but I think the optimal way to prepare for Nike Data Science interviews is to read the book Ace the Data Science Interview.
The book solves 201 interview questions taken from Facebook, Google, & Amazon. It also has a crash course on Stats, SQL & ML. And finally it's helped thousands of people land their dream job in data, which is how it's gotten to be an Amazon best-seller with over 1000+ 5-star reviews.
Also check out this job listing for a Lead Data Scientist at Nike to help you see what skilles you need for the role.