Amazon SQL Interview Questions | Top 2 Busiest Times | DATEPART

 DDL Script:

DROP TABLE IF EXISTS Orders


CREATE TABLE Orders

(

[orderid] INT,

[productid] INT,

[timestamp] DATETIME2

)


INSERT INTO Orders

VALUES

(10300,1005,'2024-03-04 16:55:00'),

(10303,1005,'2024-03-05 08:25:00'),

(10302,1009,'2024-03-04 13:37:00'),

(10304,1006,'2024-03-04 11:10:00'),

(10301,1007,'2024-03-04 15:26:00'),

(10305,1008,'2024-03-04 17:15:00'),

(10306,1007,'2024-03-04 19:05:00'),

(10340,1008,'2024-03-04 17:17:00'),

(10307,1009,'2024-03-04 17:09:00'),

(10341,1010,'2024-03-04 18:17:00'),

(10347,1011,'2024-03-04 19:09:00')


Detailed Explanation: https://youtu.be/twfYTx5b-5Y

Comments

Popular posts from this blog

50 Essential SQL Questions to Land Your Dream Job

How to find all the customers who placed orders on three consecutive days | SQL Scenario questions

ACCENTURE SQL INTERVIEW QUESTION | Change the ProductIDs