Amazon SQL Interview Question | Delivery Date Logic #amazon #sql #interview #logic #businessanalyst
In this video, I break down an interesting and commonly asked Amazon SQL Interview Question for the Business Analyst and Data Analyst roles. The challenge: - Determine the delivery dates for each order date - Delivery should be 2 days after the order date - If the delivery date falls on a holiday, shift it to the next available non-holiday date Logic: - Use a Recursive CTE to generate a continuous calendar excluding holidays - Join order dates with computed delivery dates using clean and efficient SQL logic This is one of the most practical SQL interview problems asked by Amazon, and it's perfect if you're preparing for roles like Business Analyst, Data Analyst, Data Engineer, BI Analyst, Reporting Analyst, and SQL-heavy roles. SQL Script (CREATE TABLE + INSERT STATEMENTS) CREATE TABLE order_table ( order_date DATE PRIMARY KEY, is_holiday VARCHAR(20) ); INSERT INTO order_table (order_date, is_holiday) VALUES ('2025-01-01', NULL), ('2025-01-02', NULL), ('2025-01-03', NULL), ('2025-01-04', NULL), ('2025-01-05', 'Holiday'), ('2025-01-06', NULL), ('2025-01-07', 'Holiday'), ('2025-01-08', NULL), ('2025-01-09', NULL), ('2025-01-10', NULL), ('2025-01-11', NULL), ('2025-01-12', NULL), ('2025-01-13', 'Holiday'), ('2025-01-14', 'Holiday'), ('2025-01-15', NULL), ('2025-01-16', NULL), ('2025-01-17', NULL), ('2025-01-18', NULL), ('2025-01-19', NULL), ('2025-01-20', NULL), ('2025-01-21', NULL), ('2025-01-22', NULL), ('2025-01-23', 'Holiday'), ('2025-01-24', 'Holiday'), ('2025-01-25', 'Holiday'), ('2025-01-26', 'Holiday'), ('2025-01-27', NULL), ('2025-01-28', NULL), ('2025-01-29', NULL), ('2025-01-30', NULL), ('2025-01-31', NULL); Affiliate Links I Personally Use - RoadGods Bags Buy the same travel/work bags I use: https://www.roadgods.com/?ref=AKSHAYYEKKA&utm_source=goaffiliate Or use Coupon Code: AKSHAYYEKKA for 12% off on their store. - Deeper Network DPR Mini SE (Lifetime Internet Protection) The exact device I use to protect my internet permanently: https://shop.deeper.network?sca_ref=9825330.21cSbSLoxy Liked other products too? Use Coupon Code: AKSHAYSAGAR for 5% off. If you found this video helpful, don’t forget to LIKE the video, SHARE it with your colleagues, and SUBSCRIBE to the channel for more Data Analytics, SQL, and Google Sheets tutorials every week! Your support helps the channel grow and motivates me to bring even more high-quality content to you.
Download
1 formatsVideo Formats
Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.