MENU

Fun & Interesting

Swiggy First Round SQL Interview Questions and Answers | SQL For Analytics

Ankit Bansal 10,988 4 months ago
Video Not Working? Fix It Now

In this video we will discuss 2 SQL interview questions asked in HackerRank assessment of Swiggy first round of interview. Take your SQL skills to next level : https://www.namastesql.com/ Here are the scripts: --Question 1 CREATE TABLE swiggy_orders ( orderid INT PRIMARY KEY, custid INT, city VARCHAR(50), del_partner VARCHAR(50), order_time DATETIME, deliver_time DATETIME, predicted_time INT -- Predicted delivery time in minutes ); INSERT INTO swiggy_orders (orderid, custid, city, del_partner, order_time, deliver_time, predicted_time) VALUES -- Delivery Partner A (1, 101, 'Mumbai', 'Partner A', '2024-12-18 10:00:00', '2024-12-18 11:30:00', 60), (2, 102, 'Delhi', 'Partner A', '2024-12-18 09:00:00', '2024-12-18 10:00:00', 45), (3, 103, 'Pune', 'Partner A', '2024-12-18 15:00:00', '2024-12-18 15:30:00', 30), (4, 104, 'Mumbai', 'Partner A', '2024-12-18 14:00:00', '2024-12-18 14:50:00', 45), -- Delivery Partner B (5, 105, 'Bangalore', 'Partner B', '2024-12-18 08:00:00', '2024-12-18 08:29:00', 30), (6, 106, 'Hyderabad', 'Partner B', '2024-12-18 13:00:00', '2024-12-18 14:00:00', 70), (7, 107, 'Kolkata', 'Partner B', '2024-12-18 10:00:00', '2024-12-18 10:40:00', 45), (8, 108, 'Delhi', 'Partner B', '2024-12-18 18:00:00', '2024-12-18 18:30:00', 40), -- Delivery Partner C (9, 109, 'Chennai', 'Partner C', '2024-12-18 07:00:00', '2024-12-18 07:40:00', 30), (10, 110, 'Mumbai', 'Partner C', '2024-12-18 12:00:00', '2024-12-18 13:00:00', 50), (11, 111, 'Delhi', 'Partner C', '2024-12-18 09:00:00', '2024-12-18 09:35:00', 30), (12, 112, 'Hyderabad', 'Partner C', '2024-12-18 16:00:00', '2024-12-18 16:45:00', 30); --question 2 CREATE TABLE sales_data ( order_date DATE, customer_id INT, store_id INT, product_id INT, sale INT, order_value INT ); INSERT INTO sales_data (order_date, customer_id, store_id, product_id, sale, order_value) VALUES ('2024-12-01', 109, 1, 3, 2, 700), ('2024-12-02', 110, 2, 2, 1, 300), ('2024-12-03', 111, 1, 5, 3, 900), ('2024-12-04', 112, 3, 1, 2, 500), ('2024-12-05', 113, 3, 4, 4, 1200), ('2024-12-05', 114, 3, 4, 2, 400), ('2024-12-05', 115, 3, 4, 1, 300), ('2024-12-01', 101, 1, 4, 2, 500), ('2024-12-01', 102, 1, 4, 1, 300), ('2024-12-02', 103, 2, 4, 3, 900), ('2024-12-02', 104, 2, 4, 1, 400), ('2024-12-03', 105, 1, 4, 2, 600), ('2024-12-03', 106, 1, 4, 3, 800), ('2024-12-04', 107, 3, 4, 1, 200), ('2024-12-04', 108, 3, 4, 2, 500); Zero to hero(Advance) SQL Aggregation: https://youtu.be/5Ighj_2PGV0 Most Asked Join Based Interview Question: https://youtu.be/xR87ctOgpAE Solving 4 Trick SQL problems: https://youtu.be/Ck1gQrlS5pQ Data Analyst Spotify Case Study: https://youtu.be/-YdAIMjHZrM Top 10 SQL interview Questions: https://youtu.be/Iv9qBz-cyVA Interview Question based on FULL OUTER JOIN: https://youtu.be/KQfWd6V3IB8 Playlist to master SQL : https://youtube.com/playlist?list=PLBTZqjSKn0IeKBQDjLmzisazhqQy4iGkb Rank, Dense_Rank and Row_Number: https://youtu.be/xMWEVFC4FOk #sql #dataengineer

Comment