Preparing for an Amazon interview? We spoke to Business Analysts, Data Scientists, and Engineers who recently interviewed at Amazon to source the commonly asked Amazon SQL interview questions.
Before we get into these questions, it is important to note that SQL interview questions at Amazon aren’t necessarily difficult - they are rather designed to gauge your capability to think thoughtfully.
Now, let’s get into the most common questions that were asked in Amazon SQL interviews.
Here are the most commonly asked questions to Business Analysts during Amazon’s SQL Interview:
Question: Get the top 25 highest salaried employees from a table. The table has the following columns: names of employees, salaries, and departments. The total count information was not provided.
Question: Select all devices that had more than 50,000 streams within the last 15 days.
Question: Calculate the average cost per view in the last 15 days
Question: Calculate the unique streams in the last 15 days where the video was purchased in December 2021.
Question: There are two tables, table_1 with country-specific data and table_2 with other geographical attributes. Perform a LEFT Join and add null if a country does not have any geographical attributes.
Question: In table_1 we have user ids and different activities performed by those users' ids. Calculate the total counts of activities performed by each user id.
It is important to note that during the interviews, most of these questions were to be solved without any datasets. Amazon’s hiring managers are more interested in understanding your approach to solving these problems.
How to win at these Amazon SQL Interviews? - The key is to help the interviewer understand that you went through 5-8 scenarios to figure out the best way to approach the problem. You should be able to justify your SQL syntax choices well enough.
Tips to perform well in Amazon SQL coding interviews:
We recommend that you check out the questions for BA positions above as they are generally asked to BI Engineers during SQL interviews as well. In addition to those, we recommend that you go through these interview questions too.
Question: Calculate the percentage of users who subscribed after browsing the gallery. The table to be used has the following columns: user_id, user_session, timestamp, subscribed_action, and browsed_action.
Suggested approach: To solve this, we suggest that you SELF JOIN on the last timestamp with limit = 1. Alternatively, you can also JOIN on the row number through the Window function.
Question: You have a table (table_1) that has the following columns: employee_id, employee_name, employee_department, and employee_salary - calculate the gap between the first two highest paid employees’s salary for each department.
Suggested approach: Use a Window function to sort each department and then subtract the first two in each department.
Tips to help you ace Amazon SQL Interviews as a BI Engineer:
These SQL Interview questions should help you smoothly overcome any L5 or below-level Business Intelligence Interviews.
A Senior Engineer at Amazon is expected to be able to answer the questions that a Business Analyst or a Business Intelligence Engineer could answer. In addition to that, you should be able to answer the following SQL questions too: