0% found this document useful (0 votes)
5 views

Amazon SQL Question

The document lists 100 SQL interview questions organized by difficulty level: Beginner, Intermediate, and Advanced. It covers a wide range of SQL skills, including querying, joins, aggregations, and data analysis techniques. These questions are tailored for entry-level interviews at Amazon and similar companies.

Uploaded by

shouryarma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Amazon SQL Question

The document lists 100 SQL interview questions organized by difficulty level: Beginner, Intermediate, and Advanced. It covers a wide range of SQL skills, including querying, joins, aggregations, and data analysis techniques. These questions are tailored for entry-level interviews at Amazon and similar companies.

Uploaded by

shouryarma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

100 Amazon SQL interview

questions, organized by difficulty


level

Beginner Level (1-35):

1. What is the difference between WHERE and HAVING clauses?

2. Explain the types of SQL joins (INNER, LEFT, RIGHT, FULL).

3. Write a query to retrieve all customers who purchased more than $100.

4. How do you calculate the total revenue from a purchase table?

5. Explain the difference between COUNT(*) and COUNT(column_name).

6. Write a query to retrieve the first 10 rows from a table.

7. Write a query to filter records by date range.

8. How would you use LIKE to search for patterns in text?

9. Write a query to find customers who haven't made any purchases in the last 6 months.

10. What is the difference between UNION and UNION ALL?

11. Write a query to group data by month and calculate total sales per month.

12. How do you retrieve distinct values from a column?

13. Write a query to join two tables based on a foreign key.

14. Explain the difference between CHAR and VARCHAR.

15. Write a query to calculate the average purchase amount for all customers.

16. How do you update a record in a table?

17. Write a query to count the number of customers who registered in 2023.
18. Explain the purpose of the ORDER BY clause.

19. Write a query to calculate the total revenue from each product category.

20. Write a query to retrieve all customers with more than one purchase.

21. Explain the difference between DELETE and TRUNCATE.

22. Write a query to retrieve the second-highest salary from an employee table.

23. Write a query to display the first and last name of all customers whose name starts with
‘A’.

24. Explain the difference between INNER JOIN and OUTER JOIN.

25. Write a query to retrieve the total count of orders for each customer.

26. Write a query to display the names of customers who made a purchase in the last 30 days.

27. What is a PRIMARY KEY and how is it different from a UNIQUE constraint?

28. Write a query to sort customer names in alphabetical order.

29. Write a query to select customers who registered in January and made purchases in
February.

30. What is the difference between IS NULL and IS NOT NULL?

31. Write a query to retrieve customers whose purchase total is between $50 and $100.

32. Explain the difference between LIMIT and OFFSET.

33. Write a query to calculate the percentage of orders from a specific product category.

34. Write a query to select all customers who made purchases in both 2022 and 2023.

35. How do you use the CASE statement to create conditional queries?

Intermediate Level (36-70):

36. Write a query to find unique customers who made a purchase within 10 days of
registering.

37. Write a query to retrieve the 5th highest salary from an employee table.
38. Explain the use of GROUP BY and HAVING together.

39. Write a query to display products that have not been sold in the last month.

40. Write a query to create a histogram of the number of comments per user in a month.

41. How do you handle NULL values in SQL joins?

42. Write a query to calculate the running total of purchases by customer.

43. Write a query to find the top 3 selling products in each region.

44. Write a query to calculate year-over-year growth for sales.

45. Write a query to retrieve all orders placed in the last 6 months and group them by
customer.

46. How would you optimize a query with multiple joins and aggregations?

47. Write a query using COALESCE to replace NULL values with a default value.

48. Write a query to rank customers by the total amount they have spent.

49. Write a query to retrieve the names of employees who have not received a salary
increase.

50. Write a query to find products where the price has decreased compared to the previous
month.

51. Write a query to calculate the cumulative total revenue by day.

52. Write a query to find customers who made a purchase in every quarter of 2022.

53. Write a query to retrieve the top 10 highest-spending customers.

54. Write a query to find duplicate records in a table.

55. Write a query to retrieve the most frequently purchased product category.

56. Write a query to calculate the average order value by region.

57. Explain the use of SUBSTRING in SQL and provide an example.

58. Write a query to calculate the retention rate of customers over the past year.

59. Write a query to find customers who made repeat purchases within the same week.

60. How do you use a self-join to compare records within the same table?

61. Write a query to calculate the average number of orders per customer per month.
62. Write a query to display the month-over-month growth rate for sales.

63. How would you handle performance issues in a query with large datasets?

64. Write a query to retrieve the last purchase date for each customer.

65. Write a query to calculate the lifetime value of a customer.

66. Write a query to find customers whose total purchase amount exceeds the average
purchase amount.

67. Write a query to calculate the number of days between a customer’s registration and first
purchase.

68. Write a query to list all products that were sold in December but not in January.

69. How do you use window functions like ROW_NUMBER(), RANK(), and DENSE_RANK()?

70. Write a query to merge two tables based on a common field and calculate the difference
between their values.

Advanced Level (71-100):

71. Write a query to calculate a rolling average of the last 3 months of sales by product.

72. Write a query using a Common Table Expression (CTE) to calculate cumulative sales by
region.

73. Write a query to find all customers who have made purchases in the same store multiple
times.

74. Write a query to detect anomalies in sales data based on historical patterns.

75. Write a query to retrieve customers whose total purchase amount is more than 2 standard
deviations above the mean.

76. Write a query to calculate the lifetime value (LTV) of customers based on their purchase
history.

77. Write a query to find the top 5 products with the highest month-over-month sales growth.

78. Write a query to identify customers who have not made a purchase in over 12 months.

79. Write a query to create a sales forecast for the next quarter based on historical data.
80. Write a query to retrieve the top 10 customers by purchase amount within each product
category.

81. Write a query to identify and remove duplicate records from a table.

82. Write a query to find products that have been consistently sold over the last 6 months.

83. Write a query to calculate the churn rate of customers over the past year.

84. Write a query to detect fraudulent transactions by identifying suspicious patterns.

85. Write a query to calculate the total number of refunds issued in each month.

86. Write a query to retrieve customers who have consistently increased their purchase
amount month over month.

87. Write a query to calculate the average time between purchases for each customer.

88. Write a query to detect outliers in customer spending patterns.

89. Write a query to calculate the probability of customer churn based on their purchase
history.

90. Write a query to identify underperforming products based on sales trends.

91. Write a query to predict future sales using a linear regression model in SQL.

92. Write a query to identify customers who are most likely to respond to a marketing
campaign based on past behavior.

93. Write a query to find patterns of seasonal sales in the data.

94. Write a query to calculate the average customer acquisition cost based on sales and
marketing data.

95. Write a query to optimize inventory levels by analyzing sales trends and product turnover.

96. Write a query to detect sales spikes caused by promotions or discounts.

97. Write a query to analyze customer purchase behavior and identify cross-sell
opportunities.

98. Write a query to forecast inventory needs based on historical sales data.

99. Write a query to calculate the ROI of marketing campaigns based on customer purchases.

100. Write a query to segment customers based on their purchase frequency and average
order value.
These questions cover a wide range of SQL skills, from basic querying to advanced, for entry-
level interviews at Amazon and similar companies.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy