Real Amazon SQL Interview Questions from Amazon Data Science & Data Analyst Interviews
DataLemur ?? (Ace the SQL & Data Interview)
Practice 200+ FAANG SQL & Data Interview questions! Made by Nick Singh (Ex-FB & Author of Ace the Data Interview ??)
If you've got an upcoming Data Science or Data Analyst interview at Amazon, then you better start practicing Amazon SQL Interview questions. I know that sounds boring AF, but don't procrastinate by binging Netflix: instead let's solve 3 real Amazon SQL Interview Questions together!
Amazon SQL Question #1: Highest-Grossing Items Analysis
Given a table containing information on Amazon customers and their spending on products in various categories, write a SQL query to identify the top two highest-grossing products within each category in 2022.
For example, within the "appliance" category, you might find that the top two highest-grossing products are "refrigerator" and "washing machine" and should print that out!
You can solve this exact problem interactively on DataLemur:
Hint: to solve this question, start with a SQL query that calculates the total amount spent on each product, grouped by category. Don't worry about the highest-grossing aspect just yet.
Here's a starting point in case you need a bit more help:
SELECT
category,
product,
SUM(_____) AS total_spend
FROM product_spend
WHERE EXTRACT(_____ FROM transaction_date) = 2022
GROUP BY _____, _____;
Amazon SQL Question #2: AWS Server Utilization Time
Amazon Web Services (AWS) is powered by a fleet of ~5M+ servers across 105 datacenters. Senior management has requested data-driven solutions to optimize server usage. Write a query that calculates the total time that the fleet of servers was running.
The output should be in units of full days.
You can write SQL code directly in the browser to solve this Amazon SQL Question below ????
Amazon SQL Question #4: Different Types of SQL Joins?
An interview classic - what are the different kinds of joins in SQL?
领英推荐
Besides explaining inner, outer, left, and right, the interviewer might see if you can mention cross-joins and/or self-joins.
There's a very good write up from Atlassian on SQL JOINs in case you need a refresher!
Amazon SQL Question #5: Average Review Ratings
Given an Amazon reviews table, write a SQL query to get the average stars for each product every month. The output should include the month in numerical value, product id, and average star rating rounded to two decimal places.
Hint: to extract a month from a date-time field, use the following SQL snippet:
SELECT EXTRACT(MONTH FROM submit_date) AS mth
FROM reviews;
To test your SQL answer to this problem directly in the browser, click below ??
Want More Amazon SQL Interview Questions To Practice?
You'll find more tips & practice interview questions on DataLemur's blog post 6 REAL Amazon SQL Interview Questions (Updated 2024).
It can also be helpful to practice other FAANG SQL Interview questions on DataLemur, because at the end of the day, Amazon doesn't do things ~too~ differently from other competitive tech companies.
Founder of DataLemur.com (Ace SQL Interviews) ? Best-Selling Author of Ace the Data Science Interview ? Ex-Facebook ? LinkedIn Top Voice ? 175,000+ Nerds Follow Me on LinkedIn for Data/SQL/Career tips!
1 年Great Amazon SQL interview tips here!