Under Armour employees use SQL often for analyzing sales performance predicting future inventory needs based on buying patterns. Because of this, Under Armour almost always asks SQL query questions during interviews for Data Analytics, Data Science, and Data Engineering jobs.
So, to help you prep for the Under Armour SQL interview, we've collected 9 Under Armour SQL interview questions in this blog.
As an Under Armour data analyst, analyzing reviews data is crucial. Let's say one key metric you're interested in is the monthly-average stars awarded by customers to each product.
You are given a table which contains the following columns:
Write a SQL query to determine the monthly average star rating for each product.
review_id | user_id | submit_date | product_id | stars |
---|---|---|---|---|
6171 | 123 | 2021-06-08 | 50001 | 4 |
7802 | 265 | 2021-06-10 | 69852 | 4 |
5293 | 362 | 2021-06-18 | 50001 | 3 |
6352 | 192 | 2021-07-26 | 69852 | 3 |
4517 | 981 | 2021-07-05 | 69852 | 2 |
This query first extracts the month from the then it groups the data by month and . Finally, it computes the average stars for each group, rounding it to the nearest hundredth to make the output more readable.
Pro Tip: Window functions are a frequent SQL interview topic, so practice every window function problem on DataLemur
Fun fact, Under Armor collects personal data from you and uses it in their strategies, read their page and learn what they collect!
Given a table of Under Armour employee salary information, write a SQL query to find employees who earn more money than their own manager.
employee_id | name | salary | department_id | manager_id |
---|---|---|---|---|
1 | Emma Thompson | 3800 | 1 | |
2 | Daniel Rodriguez | 2230 | 1 | 10 |
3 | Olivia Smith | 8000 | 1 | 8 |
4 | Noah Johnson | 6800 | 2 | 8 |
5 | Sophia Martinez | 1750 | 1 | 10 |
8 | William Davis | 7000 | 2 | NULL |
10 | James Anderson | 4000 | 1 | NULL |
employee_id | employee_name |
---|---|
3 | Olivia Smith |
This is the output because Olivia Smith earns $8,000, surpassing her manager, William Davis who earns 7,800.
Try this question and run your code right in DataLemur's online SQL environment:
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.
Both types of joins in SQL help you retrieve data from multiple tables and merge the results into a single table.
To demonstrate the difference between a left join versus a right join, imagine you had two database tables: an table that contains data on Google Ads keywords and their bid amounts, and a table with information on product sales and the Google Ads keywords that drove those sales.
A retrieves all rows from the left table (in this case, the table) and any matching rows from the right table (the Sales table). If there is no match in the right table, values will be returned for the right table's columns.
A RIGHT JOIN retrieves all rows from the right table (in this case, the Sales table) and any matching rows from the left table (the table). If there is no match in the left table, values will be returned for the left table's columns.
As a data analyst at Under Armour, your role involves tracking inventory across different stores and online platforms. You have access to two tables, and , that respectively capture the current items in stock and their respective transaction history, respectively.
Design a PostgreSQL database schema and write a SQL query to determine the number of items sold of each product in May 2022. How would you manage the database performance with a rapidly increasing amount of sales data?
The database schema and tables could be:
product_id | product_name | store_id |
---|---|---|
50177 | T-shirt | NY001 |
63480 | Sneakers | NY002 |
65441 | Sweatpants | CA001 |
50177 | T-shirt | CA002 |
63480 | Sneakers | NY001 |
transaction_id | product_id | sales_date | store_id | quantity |
---|---|---|---|---|
1023 | 50177 | 05/05/2022 00:00:00 | NY001 | 10 |
1024 | 63480 | 05/12/2022 00:00:00 | NY002 | 15 |
1025 | 65441 | 05/15/2022 00:00:00 | CA001 | 5 |
1026 | 50177 | 05/18/2022 00:00:00 | CA002 | 8 |
1027 | 63480 | 06/01/2022 00:00:00 | NY001 | 20 |
This query joins the and tables on and , limits the data to the sales in May 2022, and aggregates the total quantity for each product. For performance considerations, you should ensure that sales_date, product_id, and store_id columns are indexed to speed up the lookup process. Also, consider partitioning your sales table by date, so that each month or week resides in a separate, smaller, more manageable partition. Regularly archiving old data that is not frequently accessed can also improve performance.
The clause works similarly to the clause, but it is used to filter the groups of rows created by the clause rather than the rows of the table themselves.
For example, say you were analyzing Under Armour sales data:
This query retrieves the total sales for all products in each region, and uses the clause to only sales made after January 1, 2023. The rows are then grouped by region and the clause filters the groups to include only those with total sales greater than $500k.
Under Armour wants to identify loyal customers who have made purchases over $200 in total and are located in Maryland for a special promotional campaign. Write a SQL query that will identify these customers. We have and tables.
customer_id | first_name | last_name | state |
---|---|---|---|
2678 | John | Doe | Maryland |
3981 | Jane | Smith | Ohio |
7692 | Bob | Johnson | Maryland |
5391 | Alice | Brown | Maryland |
4956 | Charlie | Davis | Florida |
order_id | customer_id | total_cost |
---|---|---|
1001 | 2678 | 120.00 |
2154 | 3981 | 85.00 |
3285 | 7692 | 250.00 |
9483 | 5391 | 80.00 |
7854 | 2678 | 100.00 |
This query first calculates the total amount each customer has spent by grouping the orders table by customer_id and applying a SUM aggregate function to the total_cost field of records related to each customer (using a subquery). It then joins this data with the customers table using the customer_id field. Finally, it filters this data to include only those customers located in Maryland whose total cost is above 200 dollars, returning their first and last names.
A full outer join returns all rows from both tables, including any unmatched rows, whereas an inner join only returns rows that match the join condition between the two tables.
For an example of each one, say you had sales data exported from Under Armour's Salesforce CRM stored in a datawarehouse which had two tables: and .
: retrieves rows from both tables where there is a match in the shared key or keys.
This query will return rows from the sales and tables that have matching customer id values. Only rows with matching values will be included in the results.
: retrieves all rows from both tables, regardless of whether there is a match in the shared key or keys. If there is no match, NULL values will be returned for the columns of the non-matching table.
Here is an example of a SQL full outer join using the sales and tables:
At Under Armour, a business analysis requiring averaging could involve calculating the average price of various product categories to track trending sales and revenue metrics.
product_id | product_category | product_price |
---|---|---|
001 | Footwear | 120 |
002 | Apparel | 50 |
003 | Footwear | 130 |
004 | Equipment | 75 |
005 | Apparel | 80 |
006 | Footwear | 150 |
product_category | avg_price |
---|---|
Footwear | 133.33 |
Apparel | 65 |
Equipment | 75 |
The above SQL query first groups the product data by the category, and then within each category it finds the average of the product price. This information can provide valuable insight into which categories have the highest average price, potentially directing focus towards marketing or production of those categories.
To practice a very similar question try this interactive Amazon Highest-Grossing Items Question which is similar for sales metric analysis or this Amazon Average Review Ratings Question which is similar for product category analysis.
Under Armour manufactures sports and casual apparel. Given an "orders" table with "order_id", "product_id", "quantity", "price_each", and "order_date", can you write a query which gives the average sales (in terms of money) of each product per month?
order_id | product_id | quantity | price_each | order_date |
---|---|---|---|---|
1010 | 5831 | 50 | 79.99 | 06/01/2022 |
1025 | 5932 | 70 | 129.99 | 06/03/2022 |
1031 | 5831 | 45 | 79.99 | 06/05/2022 |
1043 | 6784 | 30 | 49.99 | 07/12/2022 |
1049 | 5932 | 60 | 129.99 | 07/15/2022 |
month | product_id | avg_sales |
---|---|---|
6 | 5831 | 5999.25 |
6 | 5932 | 9099.3 |
7 | 6784 | 1499.7 |
7 | 5932 | 7799.4 |
The query works by first extracting the month from each order date. It groups the data by month and product_id, and then calculates the average sales for each product every month. It does the calculation by multiplying the quantity of items in an order by the price of each item (quantity * price_each), and then taking the average of this for each product per month. The result is in terms of the "$", giving the average revenue generated by each product per month.
The best way to prepare for a SQL interview, besides making sure you have strong SQL fundamentals, is to practice a ton of real SQL questions that were asked in recent job interviews. Beyond just solving the earlier Under Armour SQL interview questions, you should also solve the 200+ SQL exercises on DataLemur which come from companies like Facebook, Google and unicorn tech startups.
Each interview question has multiple hints, fully explained answers along with a discussion board to see how others solved it and crucially, there's an interactive SQL code editor so you can easily right in the browser your SQL query and have it checked.
To prep for the Under Armour SQL interview you can also be wise to practice SQL problems from other apparel companies like:
In case your SQL foundations are weak, forget about diving straight into solving questions – strengthen your SQL foundations with this free SQL for Data Analytics course.
This tutorial covers SQL concepts such as different types of joins and CASE/WHEN statements – both of these pop up routinely during Under Armour SQL assessments.
In addition to SQL interview questions, the other types of questions covered in the Under Armour Data Science Interview are:
The best way to prepare for Under Armour Data Science interviews is by reading Ace the Data Science Interview. The book's got: